This article will show you the steps to find a word from a given string in JavaScript using search_word
![](https://static.wixstatic.com/media/0f65e1_5831cfce53694fc083e2bc9bb346b25d~mv2.png/v1/fill/w_62,h_32,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/0f65e1_5831cfce53694fc083e2bc9bb346b25d~mv2.png)
Code:
function search_word(text, word){
var x = 0, y=0;
for (i=0;i< text.length;i++)
{
if(text[i] == word[0])
{
for(j=i;j< i+word.length;j++)
{
if(text[j]==word[j-i])
{
y++;
}
if (y==word.length){
x++;
}
}
y=0;
}
}
return "'"+word+"' was found "+x+" times.";
}
console.log('String - Technology is best when it brings people together');
console.log(search_word('Technology is best when it brings people together', 'Technology'));
Output:
![](https://static.wixstatic.com/media/0f65e1_0ef3e4447d40423c8a8d8ec3b3d977f0~mv2.png/v1/fill/w_80,h_12,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/0f65e1_0ef3e4447d40423c8a8d8ec3b3d977f0~mv2.png)
The Tech Platform