[] why!


#1

/*jshint multistr:true */
var text = "Ludvig is going to travel the world. Ludvig lolololololololo the world!"
var myName = "Ludvig"
var hits = []

for (var i = 0; i < text.length; i++) {
if (text[i] === "J") {
console.log (i)
for (var h = i; h < (i + myName.length); h++) {
console.log (h)
hits.push(text[h]);

}

}
};
if(hits === 0) {
console.log("Your name wasn't found!");
}
else {
console.log(hits);
}
what is wrong I only get []


#2

I fixed the promblem I had to change if(text[i]==="J") to if(text[i]==="L")


#3

var text = "Ludvig is going to travel the world. Ludvig lolololololololo the world!"
var myName = "Ludvig"
var hits = []

for (var i = 0; i < text.length; i++) {
if (text[i] === "L") {
//console.log (i)
for (var h = i; h < (i + myName.length); h++) {
//console.log (h)
hits.push(text[h]);

}
}
};
if(hits === 0) {
console.log("Your name wasn't found!");
}
else {
console.log(hits);
}