Lets say I have some constructors:
function Foo() { } function FooObject() { return {} } function FooArray() { return [] } function FooFunction() { return function () {} } function FooString() { return '' } function FooNumber() { return 1337 } And I use them to create some objects:
new Foo() // creates Foo instance new FooObject() // creates object new FooArray() // creates array new FooFunction() // creates function Those make sense, but strings and numbers just end up as instances, why?
new FooString() // creates FooString instance: WAT new FooNumber() // creates FooNumber instance: WAT Why is this?
newintentionally and consciously? See stackoverflow.com/questions/383402/… This is not a loaded question; I'm just making sure you realize its implications.function FooString() { return new String('') }:)