Who can paint all the details and conditions?

415f7cb8da294af197a0361c598da3ab.jpg
That what is converted etc.
I would be very grateful!
July 2nd 19 at 18:18
1 answer
July 2nd 19 at 18:20
There is no change.
This is called "type conversion during comparison operations".
Any non-printable character, an empty collection or string with a single zero always equals 0, but not equal.
Briefly, the scheme warns: never compare lax test "==" anything with zero. It is always better to check using "===".
771622eae9cb4319b31b219bb552aa7a.jpg
0 == "0" (When comparing the number (Number) and strings (String), JavaScript tries to convert a numeric literal a string to a number. Then the obtained number is rounded to the nearest possible values of type Number.) - icie35 commented on July 2nd 19 at 18:23
: this is scheme, not javascript. So here are only the results of the comparison and conversion occur during the execution of the code. - Kyleigh_Hills commented on July 2nd 19 at 18:26
: ("\t" == 0) then converting to number, for this they are true ("\t" = 0).
Confused me [] == 0 and [] == "0".
I don't understand why this is so.
type [] = is an object, and if so, how it's transformed?
on this and asked what would split ) - icie35 commented on July 2nd 19 at 18:29
: It is surprising, but the first confused, what I wrote)
Now while the whole table will not disassemble and do not understand how it all works, not rest)
https://dorey.github.io/JavaScript-Equality-Table/ - icie35 commented on July 2nd 19 at 18:32
: {} - object [] - set. - Kyleigh_Hills commented on July 2nd 19 at 18:35
: sorry for my ignorance, but I still don't understand how this conversion works) - icie35 commented on July 2nd 19 at 18:38
: but array-like in js there is no separate data type. if typeof ([]) "object" - icie35 commented on July 2nd 19 at 18:41
: I just realized that you are + written. +"\t" you can have it converted to number, and it is equal to 0, in this everything is fine. +"\t" === 0 true - icie35 commented on July 2nd 19 at 18:44
in js: false == 0 => true - Kyleigh_Hills commented on July 2nd 19 at 18:47
: https://learn.javascript.ru/types-conversion
Line: Whitespace characters on the edges are trimmed.
Further, if you leave a blank line, then 0, otherwise a non-empty line "is read" number, with the error result NaN. - icie35 commented on July 2nd 19 at 18:50
: okay, thank you. - gustave_Kertzmann52 commented on July 2nd 19 at 18:53
I've added in the answer a clear dependence of the types in the pattern. - Kyleigh_Hills commented on July 2nd 19 at 18:56

Find more questions by tags JavaScript