In javascript, you can call a function as a function or as a constructor. For example, you can:
myObject = new Number(13);
myPrimitiveValue = Number(13);
or simply
myPrimitiveValue = 13;
I understand the difference between the results. Can you explain to me under what reasonable circumstances it is desirable to create a number, logical or string as an object? For example, the ability to set new properties (this is what you can do on objects, but can't really do on primitive values) is almost always a bad idea for objects containing number / boolean / string. Why do I need a numeric / boolean / string object?
source
share