5. Your second "for" loop ( can't make it through)


#1


text= "jim dme,cz,,j,bnx, rgdse,ddbed jim";
var myName = "jim";
var hits = [];

for (var i = 0 ; i<text.length; i=i+1);
{  if (text[i]==="j") {
    for (var j = i; j<i+myName.length; j++);{
        hits.push(text[j]);
       
        }
    }
    }


#2

you have a semi-colon after j++), this interrupts the loop, remove the semi-colon


#3

Thx so much !
When should I use the semi-colon generally ?


#4

http://www.bradoncode.com/blog/2015/08/26/javascript-semi-colon-insertion/


#5

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