5. Your second "for" loop


#1

Hi community,

I can't figure out why it says SyntaxError: missing ) after argument list. Please help me out, my code is :
/*jshint multistr:true */
var text = "My name is fabien and fabien is a basic name";
var myName = "fabien";
var hits = [];
for(var i = 0; i < text.length; i++) {
if(text[i] === "f") {
for (var j = i; j < (i + myName.length); j++){
hits.push(text([j]);
};
};
};
console.log(hits);

Thanks
Fabien


#2

i am not entirely sure what you do on tnis line:

hits.push(text([j]);

text is not a function, you simple want to push the hit to text:

hits.puts(text[j])

i removed the bracket after text (which made it a function call)