How do I get this to work?


Search Text For Your Name

It says test is not defined.

/*jshint multistr:true */
var text = "Hey how are you Alex?\
Do you want to see a movie Alex?";
var myName = "Alex"
var hits = [];
for (var i = 0; i < text.length; i++){
 if (text[i] === 'A'){
 for (var j = i; j < (i + myName.length); j++){


Hi this line


you wrote test[j] instead of text[j]


Thanks that worked!!!


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