Having a trouble with lesson 4 Your "if" statement


i am asked to see whether the current letter is equal to the first letter of my name.
and i put the code like this but i am having this error
Oops, try again. Remember how to check the value of an element in an array? You simply do arrayName[i].

var text="Ana hena Ana hena Ana hena Ana hena";
var myName="Ana hena";
var hits=[];
for (var i=0; i<text.length; i++)
    if (myName[0] === 'A'){};

so any help guys ?!


... is, 'A'. Now compare it to text[i].


oh ! so i need to compare it to the text ?
thank you 'mtf' i hope it works


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.