Problem with 2nd for loop


Your second "for" loop

It looks fine but keep getting Oops, try again. 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.

Replace this line with your code. 
/*jshint multistr:true */
var text = "ben is ben and beee is not ben";
var myName = "ben";
var hits = [];

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


now this stupid crap magically works now.


Yeah I was going to say your code is fine


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