replece() method 100%

pull/420/head
Fitsumhelina 10 months ago
parent 350fcf6335
commit 040f1bc4b8

@ -1,10 +1,12 @@
// Exercise: Level 2 // Exercise: Level 2
// Create a separate countries.js file and store the countries array into this file, create a separate file web_techs.js and store the webTechs array into this file. Access both file in main.js file // Create a separate countries.js file and store the countries array into this file, create a separate file web_techs.js and store the webTechs array into this file. Access both file in main.js file
// First remove all the punctuations and change the string to array and count the number of words in the array // 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.' let text ='I love teaching and empowering people. I teach HTML, CSS, JS, React, Python.'
const word = text.replace(/[,.]/ ,'') const word = text.replace(/[,.]/gi ,'').split(' ')
console.log(word)
// In the following shopping cart add, remove, edit items // In the following shopping cart add, remove, edit items
const shoppingCart = ['Milk', 'Coffee', 'Tea', 'Honey'] const shoppingCart = ['Milk', 'Coffee', 'Tea', 'Honey']

Loading…
Cancel
Save