Search Text for your name in Codecademy Class


#1

Can anyone see what is wrong with my code?

/*jshint multistr:true */
var text = "Hey, Clarissa how are you \
doing? My name is Clarissa.";
var myName = "Clarissa";
var hits = [];
for(i = 0; i === text.length; i++){
if(text[i] === 'H'){
for(var j = i; j < 'H' + myname.lenth; j++){
myname.push();
myname.hits();
}
}
}


#2

Hi inside your first for loops you should put i < text.lenght and inside your second for loops you shuld put j < ( i + myName.length) the pust should be like that hits.push(text[j]) so your code should be like that

var text = "Hey, Clarissa how are you \
doing? My name is Clarissa.";
var myName = "Clarissa";
var hits = [];
for(i = 0; i < text.length; i++){
if(text[i] === 'H'){
for(var j = i; j <  ( i + myName.length); j++){
hits.push(text[j]);
};
};
};

#3

Thanks!!!:slightly_smiling: