Your second 'for' loop


i've been working on this for sometime but i keep getting the message that my second for loop isnt pushing values into hits array. this is my code

/*jshint multistr:true */
var text = "hello lesley \ how are you lesley"
var myName = "lesley"
var hits = []
for (var i = text.length; i < 0; i++); {
if(text[i] === myName[0]) {
for (var j = i; j < (i + myName.length); j++) {

it prints


This is messed up. Should be,

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


that part was not even part of the phase i was to work on so didnt think i should touch it. i tried the above solution still brought the same result


Try to check your semicolons! There is missing one after hits.push(text[j]);


thank you, i had 1 semicolon at the first 'for' loop that i had to remove also. but my results werent perfect ,i got through though.will have to read more on this to understand.


A post was split to a new topic: Creating never ending loops