4/ 7 your "if" statement


I do not know what's wrong with my script, please help.


I have figured it out when I change the code as follow:
` line 3
var text = "Alan";
line 13
if ( text[i] === "A")

However, I do not know why I cannot use this:
var myName = "Alan";
if (myName[i] === "A")

Please tell me if someone know. Thanks so much.


You want to check your name is in your text, so you compare each letter of text (text[i]) with the first letter of your name (A) which results in if (text[i] === "A")


2 posts were split to a new topic: 7. result