5/7 Help?


#1

/*jshint multistr:true */
var text = "My name is Rowan and I am the only Rowan \ that I know because Rowan is not a common name.";
var myName = "Rowan";
var hits = [ ];
for (var i = 0; i < text.length; i ++); {
if (text[i] === "R") {
for (var j = i; j < (i + myName.length); j ++) {
hits.push(text[j]);
}
}
}

This is my code but it says I'm not pushing my text into the hits array. Any help and or explanation?


#2

Your code:
for (var i = 0; i < text.length; i ++);

Correct code:
for (var i = 0; i < text.length; i ++)


#3

Do this whole code

var text = "Hey, Justin Icecream Justin.";
var myName = "Justin";
var hits = []
for(var i = 0; i < text.length; i++) {
if (text[i] === 'J'){
for(var j = i; j < myName.length + i; j++){
hits.push(text[j]);
}
}
}