What i am doing wrong? "Your "if" statment"


#1


i'm stuck in the "Your "if" statment" exercice


my error is : Oops, try again. Remember how to check the value of an element in an array? You simply do arrayName[i]. Check the Hint if you need help!


my code:

/*jshint multistr:true */

var text = "Hey, how are you \
doing? My name is Emily.";

var myName = "Charly" ;

var hits = [];

for(var i = 0; i < text.length; i++)
{
    if(myName[i] = "C")
    {
            
    }    
}


#2

HI this line

 if(myName[i] = "C")

instead of myName[i] you should put text[i] then instead of teh = you should put ===
_____
to asign value to a variable you use the =
to compare two value you use == or ===


#3

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