#6 - Code returns 25 []


Now my return is 25 [ ] one on each line


/*jshint multistr:true */
var text = "Hello. My name is Betty. My mother's name was Betty. Her mother named her Betty after a favorite Aunt Betty. Some people think my real name is Elizabeth, but it isn't, it is Betty."
var myName = "Betty"
var hits = []
for (var i =0; i<text.length; i++){
     for (var j = i; j < i +myName.length; j++){
    hits.push(text [j])     
if(hits.length = 0){
    console.log("Your name was not found.");
} else {

Continuing the discussion from #5 - I am getting a number (25) returned:


Line 2, 3, 4 and 8: You miss a ";".
Line 9: Please replace the "=" operator, withe a "==".
This should work.

The "=" operator is an assigment operator. It sets a value to what is left to it.
The "==" operator is a comparison operator. It compares the value on it's left with the value on it's right.

Another operator similar to "==" is the "===" operator.
"==": Cares just for the value.
"===": cares for the value and the type.

More on operators: http://www.w3schools.com/js/js_operators.asp


In addition to what @dimitrispl pointed out
you will have to place
the code-block

if(hits.length === 0){
    console.log("Your name was not found.");
} else {

outside of BOTH of your FOR-loops.

The code-block is used to Display the Result if there where any hits


Thank you very much! I did not know there was a difference.


Have read through