[Solved] Check for the value Of a var and reply If it includes the character “Hi” [closed]


You could check for 'Hi' at index 0.

var text = "Hi I am Anonymous";

if (text.indexOf("Hi") === 0) {
    document.getElementById("test").innerHTML = "Hey Anonymous";
}
<p id="test"></p>

0

solved Check for the value Of a var and reply If it includes the character “Hi” [closed]