JavaScript: 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 ones).
const jj = { a: 4, b: 6 };

const zz = Object.getOwnPropertyNames(jj);

console.log(Array.isArray(zz));
console.log(zz[0] === "a");
console.log(zz[1] === "b");
BUY ΣJS JavaScript in Depth

List Object Properties (to Array)