Suppose there is some library javascript object jsObj
. On calling Object.keys
or Object.getOwnPropertyNames
, I get a list of properties like
[a,b,c,d]
But still I can call a function like jsObj.e()
. Why the the method e
is not part of Object.keys
or Object.getOwnPropertyNames
? How they are doing it?
Here, it says that Object.getOwnPropertyNames
will return non enumerable properties too. So what is the characterstic of property like e
above.
I am using opentok server side SDK. Using following code,
var OpenTok = require('opentok');
var opentok = new OpenTok(config.tokbox.apiKey, config.tokbox.secret);
console.log("opentok1", Object.getOwnPropertyNames(opentok));
prints -> // [ '_client',
'apiKey',
'apiSecret',
'apiUrl',
'startArchive',
'stopArchive',
'getArchive',
'deleteArchive',
'listArchives' ]
console.log("opentok2", opentok.createSession);
prints -> function (...){...}