Why there is an empty array on the result?


#1


Replace this line with your code.


#2

because on line 15, you make the length of your hits array 0.

you should check if length of hits equals zero, in programming, checking if something is equal is not done with a single equal sign, a single equal sign means assign


#3

Oh, so what i have to put there?


#4

You learned, how in JavaScript do we check if things are equal?


#5

ummm I'm not sure...
Can you explain me what to do, please?
I've build this like an instruction says me to


#6

You learned this, take a look at this exercise, which shows you the comparison operators.


#7

ok, so you mean I have to put === instead = ?
but it still gives me a wrong result(


#8

can i see an updated version of your code? preferable copy paste the code it rather then a screenshot


#9

var text = "Hi Anna!\ I'm not Anna, I am Annuta!\ ok Anna, as u wish";
var myName = "Anna"
var hits = [];
for (var i=0; i<=text.length; i++) {
    if(text[i] === "А"){
        for (var j=i; j < i + myName.length; j++) {
            if (text [j] === myName [j-i]) {
            hits.push(text[j]);
            }
}
}
}
if (hits.length === 0) {
    console.log ( "Your name wasn't found!");
} else {
    console.log(hits);
}

#10

this line:

if(text[i] === "А")

the A you are using is not the right character, i don't know what it is, but it should be A, not А, and yes, they are different


#11

O! nice) now it's done!
probably it was a russian A
Thank you!


#12