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 = "my name is Carl";
var hits = [];
for(i = 0;i < text.length+1;i++){
    if(text[i] === 'c'){
        for(i=0;i < Carl.length;i++){
            console.log( myName);


#2

point1.

var myName = "my name is Carl";

just put your name as you will be searching your name not the whole sentence.

var myName = "Carl";

Point2.
for(i=0;i < Carl.length;i++)

In this line of code...the initialization of loop will be there where it sees text[i] === 'c'
so it will be initialized not from 0 buti?
also fix the second part of for loop. i < Carl.length ,use your Error notification to fix this.

point3.
read the theory and instructions again.
After you fix those two,you will have one more thing to do. If you read theory you will know.


#3

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