I was getting this weird result when I'm trying to construct an array of objects by using for...in loop for a object
const obj = { name: 'John', age: '25' } for (const property in obj) { const obj1 = { prop1: property, prop2: obj[property] } const result = [].push(obj) console.log(result) } [{prop1: 'name', prop2: 'John'}, {prop1: 'age', prop2: '25'}] Could anyone please help?