![]() What we wish to determine in the comparison is the "truth" about the value of a reference, not the value of the reference itself. The truth is that false is not not false (that's why !!false results in false) The truth is that true is not not true (that's why !!true results in true) !! determines the "truth" of what a value is not not: The truth is that true is not false (that's why !true results The truth is that false is not true (that's why !false results ! determines the "truth" of what a value is not: It is the double-use of ! - which is the logical "not" operator. For any non-primitive objects x and y which have the same structure but are distinct objects themselves, all of the above forms will evaluate to false.!! is not an operator. Note that the distinction between these all have to do with their handling of primitives none of them compares whether the parameters are conceptually similar in structure. SameValueZero: used by many built-in operations.They correspond to three of four equality algorithms in JavaScript: Object.is() does no type conversion and no special handling for NaN, -0, and +0 (giving it the same behavior as = except on those special numeric values).Triple equals ( =) will do the same comparison as double equals (including the special handling for NaN, -0, and +0) but without type conversion if the types differ, false is returned.Double equals ( =) will perform a type conversion when comparing two things, and will handle NaN, -0, and +0 specially to conform to IEEE 754 (so NaN != NaN, and -0 = +0).Which operation you choose depends on what sort of comparison you are looking to perform. JavaScript provides three different value-comparison operations: Warning: unreachable code after return statement.Warning: -file- is being assigned a //# sourceMappingURL, but already has one.TypeError: X.prototype.y called on incompatible type.TypeError: setting getter-only property "x".TypeError: Reduce of empty array with no initial value.TypeError: property "x" is non-configurable and can't be deleted.TypeError: invalid assignment to const "x".TypeError: invalid 'instanceof' operand 'x'.TypeError: cannot use 'in' operator to search for 'x' in 'y'.TypeError: can't redefine non-configurable property "x".TypeError: can't delete non-configurable array element.TypeError: can't define property "x": "obj" is not extensible.TypeError: can't convert BigInt to number.TypeError: can't assign to property "x" on "y": not an object.TypeError: "x" is not a non-null object. ![]() Synta圎rror: Using to indicate sourceURL pragmas is deprecated. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |