When an object value is provided to the Object
constructor, that value will be returned unchanged. So, given an object obj
:
obj === new Object( obj )
and
obj === Object( obj )
Then, what's the point of doing Object( obj )
in the first place? I can understand doing Object( 'foo' )
, or Object( 123 )
- it creates a wrapper object for the primitive value, but if we already have an object obj
, why would we do Object( obj )
?
Is this pattern useless?