DEV Community

Discussion on: Which is faster: obj.hasOwnProperty(prop) vs Object.keys(obj).includes(prop)

Collapse
 
ethanarrowood profile image
Ethan Arrowood • Edited

Turns out the Array includes method is faster!
thepracticaldev.s3.amazonaws.com/i...

Collapse
 
ycmjason profile image
YCM Jason

Try a bigger object, say with 20000 keys.

Collapse
 
ycmjason profile image
YCM Jason

interesting, is this running on node?