language should be'. let's take an example of String data type. The ECMA-262 tells you that 1. "If no arguments were passed to this function invocation, let n be +0." Which means if you do like const n = Number(), The n should be initialize to a positive integer. (Try it yourself). Second point is 2. "Else, let n be ? ToNumber(value)" Which means If there are some arguments provided to Number(), The argument will be taken to ToNumber method which convers given argumenr to Number data type and return it. So const n = Number('2') and const m = Number(2) Both will result the same
Yeah that's exactly how it works
Обсуждают сегодня