I am new to JS (coming from C++). I am learning how objects and inheritance work in JS. So far I have seen expressions of the form Object.<property name>
a number of times.
Please correct me if my understanding is wrong. As far as I understand, Object
is a function, and can be invoked in new Object()
to produce a blank object. Object
has many properties. For example, a property with name prototype
, as Object
is a constructor. But I don't understand why Object
has a number of methods such as setPrototypeOf
, getPrototypeOf
. If one wants to achieve what Object.setPrototypeOf
and Object.getPrototypeOf
do, why do they have to be implemented as methods of the Object
function?