Everything seems to be correct, not sure what's wrong



Oops, try again. It looks like your second 'for' loop isn't pushing values to the hits array. Make sure it's working properly and that myName's text appears somewhere in the text variable.

Replace this line with your code. 
/*jshint multistr:true */
var text = ["Hello, my name is Steve. I like the name Steve. Do you?"];
var myName = ["Steve"];
var hits = [];
for (var i = 0; i < text.length; i ++) {
    if (text[i] === 'S') {
        for (var j = i; j < (myName.length + i); j++) {


your string variables begins with [ ] but why?
Try without [ ]:

var text = "Hello, my name is Steve. I like the name Steve. Do you?";
var myName = "Steve";


Thanks! I was under the impression they were supposed to be arrays, I've had it like that for all the previous steps. Gotta pay closer attention I guess


Actually string variable is an array of chars. That's why you can use for loop for iteration.


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