I want to generate a notification if the word 'TEST' appears in the webpage anymore than 2 times. I have this code for alerting whenever the word is found , but am unable to frame the code where the alert is announced if the word appears for more than 2 times. Please help me with this. Thank you in advance
if (/TEST/i.test (document.body.innerHTML) )
{
alert ("Word found!");
}
EDIT This code worked
var str = "TEST"; if (str.split("TEST").length > 2)
{ alert("Word Found")
}