Your second "for" loop


// This is my code...

var text = ("Frank, John, Chris, John, Rob, Jim, Rob")
var myName = "Rob";
var hits = [];
for (i = 0; I < text.length; i++) {
if (text[i] === "R"){
for (j = i; j < myName.length + i; j++)

// This is what is printed...

[ 'R' ]
[ 'R', 'o' ]
[ 'R', 'o', 'b' ]
[ 'R', 'o', 'b', 'R' ]
[ 'R', 'o', 'b', 'R', 'o' ]
[ 'R', 'o', 'b', 'R', 'o', 'b' ]

// I am able to pass the lesson but can someone please confirm whether or not I have set this up correctly? Thanks.



Returns? You don't have a function, not sure what you mean. If you mean printing, then your code does not print anything at all, you're not calling console.log


If you're saying that I suggested that, then I did not. You seemed to be asking about why your code prints "6". It's not.


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