From 7443ca6c17243acc1ed22d7b5f10d1cb48687934 Mon Sep 17 00:00:00 2001 From: hansmbua Date: Tue, 22 Nov 2022 20:54:55 +0100 Subject: [PATCH] add new solutions --- 02_Day_Data_types/string_data_types.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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);