neaumusic neaumusic - 5 months ago 7
Javascript Question

How does Object have more functions than an actual object?

I'm confused why

var obj = {};
or
var obj = new Object();
then
obj.getOwnPropertySymbols
is undefined??




example 1




example 2

Answer

Object itself has some methods defined, such as Object.keys. These aren't defined on Object.prototype, so they're not available on object instances.

Comments