Need a correction


var text = "hello hello hello hello hello Kanaya hello hello hello Kanaya hello hello Kanaya hello hello";
var myName = "Kanaya"
var hits =[];

if(text[i] === 'K'){

console.log("your name wasn't found!");

The system told that the code is right but.. the output in the console just "[ ]"

What's wrong?
can you guys give me a correction..


This is not a comparison. You should rethink it :slight_smile:


Problem is here:

if(hits.length=0) { ... }

You used wrong operator, try == or === instead.
= - assignment operator
== - equal to
=== - equal value and equal type


alright i got it... thank you :smiley:


yes i did lol thank you


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.