diff --git a/solutions/day-2/level1.js b/solutions/day-2/level1.js index efe39d7..df73ed7 100644 --- a/solutions/day-2/level1.js +++ b/solutions/day-2/level1.js @@ -47,7 +47,7 @@ console.log(challenge.startsWith('30')); // 22.question console.log(challenge.endsWith('JavaScript')); // 23.question -console.log(challenge.matchAll('a')); +console.log(challenge.match(/a/g)); // 24.question console.log('30 Days Of '.concat('JavaScript')); // 25.question diff --git a/solutions/day-2/level3.js b/solutions/day-2/level3.js index e69de29..cc4fdd8 100644 --- a/solutions/day-2/level3.js +++ b/solutions/day-2/level3.js @@ -0,0 +1,13 @@ +// 1.question +let word = 'Love is the best thing in this world. Some found their love and some are still looking for their love.'; +console.log(word.match(/love/gi).length); +// 2.question +let word1 = 'You cannot end a sentence with because because because is a conjunction'; +console.log(word1.match(/because/gi).length); +// 3.question +const sentence = '%I $am@% a %tea@cher%, &and& I lo%#ve %te@a@ching%;. The@re $is no@th@ing; &as& mo@re rewarding as educa@ting &and& @emp%o@weri@ng peo@ple. ;I found tea@ching m%o@re interesting tha@n any ot#her %jo@bs. %Do@es thi%s mo@tiv#ate yo@u to be a tea@cher!? %Th#is 30#Days&OfJavaScript &is al@so $the $resu@lt of &love& of tea&ching'; +console.log(sentence.replace(/[^a-zA-Z0-9]/g, '')); +// 4.question +let word2 = 'He earns 5000 euro from salary per month, 10000 euro annual bonus, 15000 euro online courses per month.'; +let arr = +(word2.replace(/[^0-9]/g, '')); +console.log(arr); \ No newline at end of file