Topic number 4


#1


What is wrong with my code?

/*jshint multistr:true */
var text = ["Wczoraj Kamil io domu i sie sprzedal"];
var myName = ["Kamil"];
var hits = [];

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


#3

'' 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.''


#4

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