Need your helps to make me understand why. (5.Your second"for" loop)


#1

It's hard for me to either understand and figure out** why the result is like that?** (The result is 12.) Please help me to understand about that. Thanks!

/*jshint multistr:true */
var text = "Hey, Sungho! Are you fun or not fun?? Sungho";
var myName = "Sungho";
var hits = [];

for (var i = 0; i < text.length; i ++){
if (text[i] === 'S') {
for (j = i; j < myName.length+i; j++){
hits.push(text[j]);

    }
}

};


#2

i think it is 12, because the hits array is 12 in length (i think), in the next exercise you will print out you hits, don't bother about the 12 too much