Lesson 6 part 5 i dont know whats wrong


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++){


What makes you say it's wrong?
There's got to be some kind of problem that you're trying to solve, right? What is that problem? What have you done to try to solve it? What prevents you from doing so?


it says It looks like your second 'for' loop isn't pushing values to the hits array. Make sure it's working properly and that myName's text appears somewhere in the text variable.


Seems like a good start would be to print out that array then and see if that's the case

And when you've identified what's different about that array from what you expected, then you'll have to think about why it would have been different and that'll probably tell you which part of the code wasn't doing its job and you can continue your investigation there


which array is it lol im sorry


Do you mean that you see more than one in your code? Or that you don't see any? Do you know what an array is? What does your code use an array for?


i did that before it didnt work


Your first loop is only firing if i > text.length. Try a less than operator instead;


lol thats crazy it worked :triumph:


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