From d1e60985a693c1de68227e98678e9d415af30687 Mon Sep 17 00:00:00 2001 From: Tanvir Islam streame Date: Wed, 20 Nov 2019 23:56:54 +0600 Subject: [PATCH] Added slug functionality --- 16. Make string to slug/index.html | 12 ++++++++++++ 16. Make string to slug/main.js | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 16. Make string to slug/index.html create mode 100644 16. Make string to slug/main.js diff --git a/16. Make string to slug/index.html b/16. Make string to slug/index.html new file mode 100644 index 0000000..6bc2b84 --- /dev/null +++ b/16. Make string to slug/index.html @@ -0,0 +1,12 @@ + + + + + + + Document + + + + + \ No newline at end of file diff --git a/16. Make string to slug/main.js b/16. Make string to slug/main.js new file mode 100644 index 0000000..1f259a4 --- /dev/null +++ b/16. Make string to slug/main.js @@ -0,0 +1,8 @@ +function textToSlug(text) { + return text + .toLowerCase() + .replace(/[^\w ]+/g,'') + .replace(/ +/g,'-'); +} + +console.log(textToSlug("I am tanvir")); \ No newline at end of file