DEV Community

Discussion on: hasOwnProperty considered harmful

Collapse
 
wintercounter profile image
Victor Vincent

Usually I use

for (const key of Object.keys(obj)) {
    console.log(key)
}

Also you can seal and/or freeze objects if that's the desired effect.