Advertisement
tinyevil

Untitled

Oct 18th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. Tests two expressions for equality. The result is true if the expressions are equal.
  2.  
  3. If the data types of the two operands match, the definition of equal depends on the data type of the operands:
  4.  
  5. Values of type int, uint, and Boolean are considered equal if they have the same value.
  6. Numbers with matching values are considered equal, unless they are both NaN.
  7. If the value of both operands is null or undefined, they are considered equal.
  8. String expressions are equal if they have the same number of characters and the characters are identical.
  9. For XML objects:
  10. If one operand is a text or attribute node and the other has simple content, both operands are converted to strings with the toString() method and are considered equal if the resulting strings match.
  11. Otherwise, objects are considered equal only if the qualified name, attributes, and child properties for both objects match.
  12. XMLList objects are considered equal if they have the same number of properties and both the order and values of the properties match.
  13. For Namespace objects, values are considered equal if the uri properties of both objects match.
  14. For QName objects, values are considered equal if the uri properties of both objects match and the localName properties of both objects match.
  15. Variables representing objects, arrays, and functions are compared by reference. Two such variables are equal if they refer to the same object, array, or function. Two separate arrays are never considered equal, even if they have the same number of elements.
  16.  
  17. If the data types of the operands do not match, the result is false except in the following circumstances:
  18.  
  19. The operands' values are undefined and null, in which case the result is true.
  20. Automatic data type conversion converts the data types of String, Boolean, int, uint, and Number values to compatible types and the converted values are equal, in which case operands are considered equal.
  21. One operand is of type XML with simple content (hasSimpleContent() == true), and after both operands are converted to strings with the toString() method, the resulting strings match.
  22. One operand is of type XMLList, and either of the following conditions is true:
  23. The length property of the XMLList object is 0, and the other object is undefined.
  24. The length property of the XMLList object is 1, and one element of the XMLList object matches the other operand.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement