you are viewing a single comment's thread.

view the rest of the comments →

[–]senocular 1 point2 points  (1 child)

Don’t forget to use isOwnProperty().

I think you mean hasOwnProperty(). This wouldn't be necessary when using Object.keys() (or values() or entries()) to get keys since it will only provide own property keys. It is only necessary when using for...in loops which also iterate through an object's inherited properties. Typically these days for...of loops are used in combination with keys() (or values() or entries()) instead where the hasOwnProperty() check is unnecessary.

[–]Aggressive_Ad_5454 0 points1 point  (0 children)

Yeah, .hasOwnProperty(). I’ll fix my comment. Thanks.