Efficiency of code walkthrough required


#1

Hey,
This is my js code for the exercise. It works fine for all cases but how efficient is it.
/*jshint multistr:true */
var text = "shatta, Who are you? \
What do you want? \
Whats your so called purpose, shatta";
var myName = "shatta";
var i,j;
var hits=[];
for(i=0; i < text.length; i++) {
if(text[i] === 's' && text[i+1] === 'h' && text[i+2] === 'a' && text[i+3] === 't' && text[i+4] === 't' && text[i+5] === 'a') {
for(j=i; j < i+myName.length;j++) {
hits.push(text[j]);
}
}
}
if(hits.length === 0) {
console.log("Your name wasn't found!");
}
else {
for(var i=0 ; i < hits.length ; ) {
console.log(hits[i]+hits[i+1]+hits[i+2]+hits[i+3]+hits[i+4]+hits[i+5]);
i=i+6;
}
}