5. your second "for loop"


#1

can you help me with this? thanks

/*jshint multistr:true */

text = "star star star star star / Tin star star star star star /Tin star star star star star/ Tin star star star star";
var myName= "Tin";
var hits=[];

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


#2

this line of code:

if(text[0]==="T")

why do you zero here? I would use i since that is what you use to loop over your text variable


#3

thanks for your help i figure out it too. but only letter "T" print in the end? :frowning:


#4

just the console echoing the last value, you will get to printing in the next exercise


#5

Also the semicolon between ) and { will create a problem: