Stuck help don't know what's wrong the the code (oops try again!)


#1



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


#2

Could you give the community more information regarding your error? Screenshots?


#3


#4
/*jshint multistr:true */
var text = "kk";

var myName = "myName";

var hits = [];

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

If you now compare the text that I've written here, you should see what your issue was - you're effectively not out outputting your hits anywhere - that's the main issue!


#5

Still having the same issues