Please Help!


#1

/*jshint multistr:true */

var text = "Sparky is really cool \
I love Sparky very much. Sparky is the \
best. Sparky is awesome";
var myName = "Sparky";
var hits = [];
for(var i=0;i if(text[i] === "S"){
for (var j = i;j hits.push(text[j])
}
}
};
if("/*hits.length is 0*/"){
console.log("Your name wasn't found!");
}
else{
console.log(hits);
};
It is supposed to use the else statement in the last couple lines, but instead it is using the if statement. Can you please help?


#2
/*jshint multistr:true */

var text = "Sparky is really cool \
I love Sparky very much.  Sparky is the \
best.  Sparky is awesome";
var myName = "Sparky";
var hits = [];
for(var i=0;i<text.length;i++){
    if(text[i] === "S"){
        for (var j = i;j<i+myName.length;j++){
            hits.push(text[j])
        }
    }
};
if(hits = 0){
    console.log("Your name wasn't found!")
}else{
    console.log(hits)
};

I even tried reformatting it, and the else statement came out, but it came out as zero


#3

It is supposed to come out

["S","p","a","r","k","y"]


#4

Should be,

if (hits === 0) {