I cannot find the relevant documentation, but it seems that the Object function returns a new object that wraps the passed value or returns an argument if it is already an object; otherwise, the test === always returned false.
Object(5) === 5 // false, Object(5) creates Number object Object(null) === null // false, Object(null) creates an empty object var foo = { prop: 'value' }; Object(foo) === foo // true!? Argument is not wrapped
This behavior seems to work to check if the value is an object.
Update
It looks like this is in the specification :
When the Object function is called with no arguments or with a single argument value, the following steps are taken:
1. If the value is null, undefined or not specified, create and return a new Object in the same way as if the standard built-in Object constructor was called with the same arguments (15.2.2.1).
2. Return ToObject (value).
And the result of ToObject - this input object is also defined in the specification .
Jacob source share