5/7 what's wrong with my code?


#1

var text = "Catherine code to find my name Catherine";
var myName = "Catherine"
var hits = [];

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

console.log(hits);


#2

In hits.push() inside the second "for" you need to write text[j]. Because you're need to push letters from your name in to the array.
And also remove semicolon in the last brace.


#4

Also,

if(text[i] === 'C' {  // missing )

as in,

    if (text[i] === 'C') {