I guess that javascript will parse (2).valueOf()
to new Number(2).valueOf()
but why it doesn't for the first one ?
According to the operator precedence, the grouping operator shall have a higher priority than the member access https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence
So why (2)
is not be evaluated first and yield 2
instead of be parsed to new Number(2)
?