let paragraph = "Hello Freecodecamp student's , free , freecodecamp , free learning";
let word = /free/ig;
let result = paragraph.match(word);
console.log(result);
var resultCount=0;
if(Array.isArray(result)){
for(var i=0;i<result.length;i++){
resultCount++;
}
console.log("result count = "+resultCount);
}
//result
//Free,free,free,free
//result count = 4
Maybe you can use String.split(" ") to split the paragraph into an array of words. Then you can use Array.length to get the length of the array.
Thanks bro
there have many ways to do it .