Second for loop is killing me


var text = "Kathy case manager Mastic Beach street bus";
var myName = "Kathy";
var hits = [];
for (var i=== 0; i < text.length; i++)
if (text[i]=== "K") {
for (var j=== i; j < (i + myName.length); j++)

SyntaxError: Expected ';'

Replace this line with your code.


First problem,

in the begin you are just setting i = to 0 but instead you used the assignment operator ===, should be,

for (var i=0; i &lt; text.length; i++)

Same problem here,

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



You need to close your last bracket with a semi colon, ;


You are wonderful. I will definitely pay closer attention. Thank you!!!


You're welcome :slight_smile:


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