Problem with syntax


#1


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


Oops, try again. There was a problem with your syntax.


var text = "jfasdlfj jack ajdskl \
fjdskjackjack.";
var myName = "jack";
var hits = []
for (i = 0, i < text.length, i ++); {
             if (text[i] === "j"){
                     for(var i = j, i < i + myName.length, i++);
                     { 
                    hits.push('i');
                    }
        hits[0];
             };
    }


#2

Should be j < .... The semi-colon at the end should not be there.

This will only push the index of the first letter. It should be the letter at index j.

This line does not belong.


#3

I agree with @mtf

But you are also supposed to use semi-colons ; rather than commas inside your for statements parenthesis.


#4

I take it you mean instead of commas?


#5

Haha, quite possibly :grin:


#6

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