aCopy === arr; Why is it false?
自律者自由
自律者自由 2017-10-25 14:25:22
0
3
1825

aCopy === arr; Why is it false?

They have the same value, but are their types different? Aren't they all array types?

自律者自由
自律者自由

reply all(3)
有人@我

There is no such thing as an array type. Arrays belong to objects. When judging, if you use ===, you can

  1. Use typeof first to print the parameters you want to compare, and judge first. Type

  2. Judge their values

    If all are equal, true will be returned. Generally, no one compares arrays, which is more troublesome

  3. ==, it is a simple comparison of values. As for the type, it does not matter, that is, 1 of the number type and 1 of the string type, the values ​​​​are equal

张

It is recommended that you take a good look at the usage of ""====""

0

=== It means that all are equal, and the values ​​and types are equal, it is called congruent.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template