I read thei instruction and I don't know what did i did wrong



Oops, try again. Careful: your second 'for' loop should stop when it reaches its current point in the string + myName.length.

var text = "I my neme is Carl,\
            yes Carl is realy my\
var myName = "Carl";
var hits = [];
for(i = 0;i < text.length+1;i+=j){
    if(text[i] === 'c'){
        for(var j=i;i < myName.length;i++){
            console.log( myName);.


for(i = 0;i < text.length+1;i+=j) You have to fix last 2 parts of your for loop ?

for(var j=i;i < myName.length;i++)
as you initiated loop fromj ,so same should be incremented in your second part of for loop ? in this... i < myName.length so it can go over entire length of myName?

also you had to push each letter to your hits Array. (Read theory of this exercise!)

I hope it helps!


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