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


#1


https://www.codecademy.com/courses/javascript-beginner-en-XEDZA/0/5?curriculum_id=506324b3a7dffd00020bf661

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\
            name.";
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);.


#2

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

point2.
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?

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

I hope it helps!


#3

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