5. Your second for loop


Here is my code.

var text = "My name is Chris, CHris like to code and Chris \
is a handsome guy!";
var myName = "C";
var hits = [];
for (var i = 0; i < text.length; i++){
if (text[i] === "C"){
for (var j = i; j < myName.length; j++)

If someone could just point out my mistake and educate my feeble mind. Thanks!


Hey @chipsolver23726,

You forgot the two corresponding brackets here. :smiley:


Also in the condition a +i or i+ is needed :smile:

for (var j = i; j < i+myName.length; j++){


Thanks for your help guys! I passed it. I am not sure I am understanding something though. Is it suppose to just output all the letters in my name individually separated by commas in an array?


I would also like to know how really this works.