console.log(search_word('The quick brown fox', 'fox'));
console.log('************')
console.log(search_word('aa bb cc dd aa', 'aa'));
function search_word(str,find)
{
var temp = str.split(' ');
console.log(temp);
var count = 0;
for(var i =0 ; i<=temp.length ; i++)
{
if(temp[i] === find)
{
count++;
}
}
return find+' was found '+count+' Times';
}
To embed this program on your website, copy the following code and paste it into your website's HTML: