This is my JavaScript code :
var a = 'how are you';
if (a.indexOf('r') > -1)
{
alert('yes');
}
else {
alert('no');
}
This code alert('yes'). It only matches the character 'r' is present in the string or not. But I want to match a full word(like 'are') not a character. How I can do this?