Your second "for" loop


#1

I have no idea what I'm doing wrong here. I had to start over twice, now.

/*jshint multistr:true */
var text = "I am Taylor."
var myName = "Taylor"
var hits = [];
for (var i = 0; i < text.length; i++) {
if (text[i] ==== myName[0]) {
for (j = i; j < myName.length + i; j++) {
hits.push(text[j]);
}
}
}

Halp!


#2

Hi gigasurfer32051,

if (text[i] ==== myName[0]) {

should be

if (text[i] === myName[0]) {

#3

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