Explain please 5-7


#1

/*jshint multistr:true */

var text = "NIKITANIKITANIKITA"
var myName= "NIKITA"
var hits =[]
for( var i=0;i if (text[i]=== 'N'){
for(var n=i;n hits.push('n');
}
}
}
if (hits.length === 0) {
console.log("Your name wasn't found");
}
else {
console.log(hits);
}

Q:Why do we plus to myName,length i?I is var for iteration only,why should we plus it?with i t have output 18 times, without i only 6


#2

@csswhiz28377,

You will have modify your FOR-loop statements
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for