3 ms·
It's not consistent, calling those functions with `new` returns an object representation of the primitive value (you can get the primitive value by calling .val
by draw_down 11y ago
It's not consistent, calling those functions with `new` returns an object representation of the primitive value (you can get the primitive value by calling .valueOf or by coercing). It does not cause an error.
- AgentME 11y agoThe correct way of using it is consistent. I'd be surprised if being able to use `new` with the other primitive functions was ever specifically intended and if that choice to allow it wasn't regretted. It's a common source of confusion and is not useful.