このコード:
var text = "filler text filler text Michael filler text Michael";
var myName = 'Michael';
var hits = [];
for (var i = 0; i < text.length; i++){
if (text[i] === "M"){
for (var j = i; j < (i + myName.length); j++){
hits.push(text[j]);
myName.toString();
}
}
}
if (hits === 0){
console.log("Your name wasn't found!");
}
else {
console.log(hits);
}
["M" "i" "c" "h" "a" "e" "l"] を出力するにはどうすれば "Michael" を出力できますか? ありがとう