Need help with "Your first "for" loop" - The code should run but it doesn't


#1

Hey everybody, here is my code:

...

/*jshint multistr:true */
var text = "John is my name don't wear it out John";
var myName = "John";
var hits = [];

for (var i = 0; i < text.lenth; i++);
{

}

...

From what I can see the syntax is exactly correct but I keep getting the error "Oops, try again. Does your 'for' loop iterate until it hits text.length?"
It's a bit frustrating.. Can anybody give me a clue?

Thanks :slight_smile:

EDIT: Omg that's embarrassing, I misspelled "length" as "lenth".. How do I delete this thread?


#2

@deskjocky I mean, it's good that you were able to catch your own mistake though! :smile: (Plus, to be fair, some people do say it that way :slight_smile: )

How do I delete this thread?

Not sure but I think maybe you can flag it "for other reasons" and request deletion?