4 ms·
but "new Number(x)" is not equal to "Number(x)". So, it's tricky, I guess?
by iso-8859-1 14y ago
but "new Number(x)" is not equal to "Number(x)". So, it's tricky, I guess?
- ville 14y agoNumber(x) performs a type conversion to number, new Number(x) constructs a primitive wrapper object Number: typeof Number("10") //=> "number" typeof new Number("10") //=> "object" The same applies to other wrapper objects, that is, Boolean and String.