Code not working


#1

Why isn't this working????
/*jshint multistr:true */

var text = "fred bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla fred bla bla bla bla bla bla bla blabla bla bla bla bla bla bla bla bla bla bla bla fred bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla fred"

var myName = "fred"
var hits = []

for(var i = 0; i < text.length; i += 1){
if (text[i] === myName){

}
for(var j = i; j > (myName.length + i); i += 1){

}
hits.push(text[j])

if (hits.length === 0){
console.log("Your name wasn't found")}
else{
console.log("We found your name")
console.log(hits)}

}


#2

@star_warsisawesome,

-1

j > (myName.length + i) in you second FOR-loop
should be
j < (myName.length + i);

-2

In you _second FOR-loop you will want to
=increment= the variable j instead of i


#3

in addition to what @leonhard_wettengmx_n has said
According to this line

You will never get any hits. you are checking if the current character is equal to your entire name but that is not possible.

You rather want to be checking if the current character matches the first letter of myName