Search code examples
javascriptecmascript-6ecmascript-5

Reference- What does this line mean in ecmascript?


Can someone help me to understand what this block is trying to say. I am going through understanding ecmaspec of Object.is. I come to this block of code. I am not able to understand what it is trying to depict is

2. If Type(x) is Number or BigInt, then
Return ! Type(x)::sameValue(x, y).

Full code is this:

1.If Type(x) is different from Type(y), return false.
2.If Type(x) is Number or BigInt, then
      Return ! Type(x)::sameValue(x, y).
3.Return ! SameValueNonNumeric(x, y).

I pretty much understand first and third statement but was not able to understand second point. Any help or reference would be helpful.

Here is doc reference: https://tc39.es/ecma262/#sec-samevalue


Solution

  • If x is a number, use a sameValue overload method of one of the number types to compare x and y.