0

Quite a beginner here. Thanks for your help.

As per my understanding, a "number" in JS is something like 8 bytes, but a char is more like 2 bytes. But this code returns true.

var x = "10";

if(x == 10){

return true;

}

So, is it just parsing a string into a number (and probably vice versa) for every comparison?

I am trying to understand how it works, under the hood.

  • For two values to be equal, they have to also be of the same type. `===` is comparison without automatic type conversion. `==` is comparison *with* automatic type conversion. – Rocky Sims Mar 27 '22 at 18:09

0 Answers0