Second loop


#1


/*jshint multistr:true */
var text = " yolo ello hello pello samarth khello chlo samarth";
var myName = "samarth"
var hits = [];
for ( var i = 0;i < text.length;i+=1){
    if (text[i] === 's' ){
        for(var j = i;j<(length.myName + i);j+=1){
            hits.push(text[j]);
        }
    }
}


#2

@systemninja17166,
You could have added

console.log( hits );

to see the result of your code......


#3

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