diff --git a/02_Day_Data_types/string_data_types.js b/02_Day_Data_types/string_data_types.js index fd61150..7f64997 100644 --- a/02_Day_Data_types/string_data_types.js +++ b/02_Day_Data_types/string_data_types.js @@ -1,7 +1,7 @@ -let space = ' ' // an empty space string -let firstName = 'Asabeneh' -let lastName = 'Yetayeh' -let country = 'Finland' -let city = 'Helsinki' -let language = 'JavaScript' -let job = 'teacher' +// 'Love is the best thing in this world. Some found their love and some are still looking for their love.' Count the number of word love in this sentence. +let quote = "Love is the best thing in this world. Some found their love and some are still looking for their love.' Count the number of word love in this sentence."; + +let pattern = /love/gi; +let getwords = quote.match(pattern); + const numberOfLove = getwords.length; + console.log(numberOfLove);