The '==' in JavaScript is equivalent to operators

zhaozj2021-02-16  202

The '==' in JavaScript is equivalent to operators

Wooden (Blog.9cbs.net/luckybeggar)

MSN: luckybeggar@21cn.com

-------------------------------------

Since I have chosen the distance, I only take care of the wind and rain!

1 Compare numbers, strings, and Boolean values, it is quantified, and only when the two variables are stored, they return to True; 2 compare objects, arrays, and functions are referenced, only two True is returned when the variable reference is the same object; compares the rules of the two values. * If the two values ​​have the same type, it compares the two values ​​to see if it is equal - if the two values ​​are characters Skewers, and the characters in the same location in the string, they are equal - if both values ​​are numbers, then they are equal, but if there is a nan, or both are NAN them, if they are all Boolean True or all false, equal - If two values ​​references the same object, array, or function, then they are equal, if reference is different objects, even if it is convertible to the same original value, - If both values ​​are null, the other is undefined, they are equal * If the types of the two values ​​are different, they should be converted into the same type to use the above rules - if a value is a number, One is a string, then the string is converted into a digital comparison - if there is a value true, then he is converted to 1, then compare, false is converted to 0- If a value is an object, while another value is a number or String, then convert the object into a value of an original type, then compare, JavaScript first try Valueof () conversion, try totring () conversion.

转载请注明原文地址:https://www.9cbs.com/read-8228.html

New Post(0)