From 350fcf6335e52b74fabba6280738efa1f3874793 Mon Sep 17 00:00:00 2001 From: Fitsumhelina Date: Sat, 23 Nov 2024 21:36:23 +0300 Subject: [PATCH] replece() method 100% --- Exercises/day-1/array-exersise-2.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Exercises/day-1/array-exersise-2.js b/Exercises/day-1/array-exersise-2.js index 9c44dae..c7a958d 100644 --- a/Exercises/day-1/array-exersise-2.js +++ b/Exercises/day-1/array-exersise-2.js @@ -3,13 +3,8 @@ // First remove all the punctuations and change the string to array and count the number of words in the array -let text = - 'I love teaching and empowering people. I teach HTML, CSS, JS, React, Python.' -console.log(words) -console.log(words.length) -["I", "love", "teaching", "and", "empowering", "people", "I", "teach", "HTML", "CSS", "JS", "React", "Python"] - -13 +let text ='I love teaching and empowering people. I teach HTML, CSS, JS, React, Python.' +const word = text.replace(/[,.]/ ,'') // In the following shopping cart add, remove, edit items const shoppingCart = ['Milk', 'Coffee', 'Tea', 'Honey'] @@ -28,4 +23,4 @@ const frontEnd = ['HTML', 'CSS', 'JS', 'React', 'Redux'] const backEnd = ['Node', 'Express', 'MongoDB'] console.log(fullStack) -["HTML", "CSS", "JS", "React", "Redux", "Node", "Express", "MongoDB"] \ No newline at end of file +["HTML", "CSS", "JS", "React", "Redux", "Node", "Express", "MongoDB"]