Why isnt it working


#1

var text = 'Hey guys Im Emmanuel';
var myName = 'Emmanuel';
var hits = [];
for(var i = 0; i > text.length; i++){
if(text[i] === 'E') {
}
for(var j = i; j < (i + myName.length); j++){
hits.push(text[j]);
console.log(hits);
}
}


#2

You have a useless closing bracket at the last line.


#3

actually, the closing bracket on the last line is closing the for loop:

But, @ironfist34, if you need help, i need to know what lesson you are on, so I need either the name or the link.
:slight_smile:


#4

Oops sorry, I didn't see that it's a loop inside a loop.


#5

it's fine! It's what happens when the code isn't formatted :grimacing:
Even though it works unformatted, it's definitely harder to read.


#6

iam on chapter 6 search text for your name section 5 and i did format it it just got like that because i copied it


#7

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