I can't figure this out. Could someone help me?


#1

Could someone please tell me what I need to do in order to fix this code?

/*jshint multistr:true */
var text = "Minecraft is awsome!";
var myName = "Kolten";
var hits = [];
for (var i = 0; i >= text.length; i += 1) {
if(text[i] === 'K') {
for(j = i; j hits.push(text[i]);
}
}
}

Thanks


#2

Be sure your name actually does appear in the text:

var text = "Minecraft is awesome!";

Some more practice is needed on for statements:

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

The value of i cannot be both zero and non-zero at the same time. It can be zero and less than a non-zero at the same time, though.

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

Another indication that practice on for statements is needed...

for(j = i; j hits.push(text[i]);

This should read,

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

#3

Thanks but that was not the Problem. The problem was that on
---for (var i = 0; i >= text.length; i +=1)
I have the wrong sign - > instead of this <