My second for loop


#1

/*jshint multistr:true */

var text = "hrd gsg uebsiug ywbeug biuesbgwueb iubweguybwiuegbui ybseub usebgiuseybg i bob iwbFuiey ebge fseg se g bob fesg eg seg seg bob egs eg seg se";

var myName = "bob";

var hits = [];

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


#2

In the second for loop
j is a number and text is a string; you cannot add a number and a string.
Also, in the first for loop you have i <= text.length; remember string count begins at zero. That is, text[0] = h, text[1]= r and so on. So count is always less than the length of the text.