JS: Object .getOwnPropertyNames

By Xah Lee. Date: . Last updated: .
Object.getOwnPropertyNames(obj)

Return a Array of all own string property keys.

(Exclude Symbol keys. Include non-enumerable keys).

const jj = { dog: 4, cat: 6 };

const zz = Object.getOwnPropertyNames(jj);

console.log(zz);
// [ "dog", "cat" ]