DEV Community

loading...

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

Collapse
ethanarrowood profile image
Ethan Arrowood Author • Edited

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

Collapse
ycmjason profile image
Jason Yu

Try a bigger object, say with 20000 keys.

Collapse
ycmjason profile image
Jason Yu

interesting, is this running on node?