JS: Object.getOwnPropertyNames
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");