What is object.key()??

I am unable to understand this pls help
5 Replies
13eck
13eck6mo ago
Object.keys() gives you an array of all the keys in a given object: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
MDN Web Docs
Object.keys() - JavaScript | MDN
The Object.keys() static method returns an array of a given object's own enumerable string-keyed property names.
Shivam
ShivamOP6mo ago
thank you
ἔρως
ἔρως6mo ago
it actually only gives an array of enumerable keys, which means, stuff like toString() and others wont be in the array
Choo♚𝕂𝕚𝕟𝕘
It won't include keys from prototypes, any key set to not be enumerable, and keys that are symbols.
ἔρως
ἔρως6mo ago
thats what i said: only enumerable keys
Want results from more Discord servers?
Add your server