same-value-x
Determines whether two values are the same value.
module.exports(value1, value2)
⇒ boolean
⏏
This method is the comparison abstract operation SameValue(x, y), where x
and y are ECMAScript language values, produces true or false.
Kind: Exported function
Returns: boolean
- A Boolean indicating whether or not the two arguments are
the same value.
Param | Type | Description |
---|
value1 | * | The first value to compare. |
value2 | * | The second value to compare. |
Example
import sameValue from 'same-value-x';
console.log(sameValue(1, 1));
console.log(sameValue(true, true));
console.log(sameValue(NaN, NaN));
console.log(sameValue(true, false));
console.log(sameValue(0, -0));