I bet it has to be Object.hasOwnProperty.
Object.hasOwnProperty would be more comparable to the in operator. in should be a little bit more complicated as it looks through the prototype chain as well. But for keys that are already attached to an Object, I suppose it should give a similar, if not the same, time complexity.
Turns out the Array includes method is faster!
Try a bigger object, say with 20000 keys.
interesting, is this running on node?
We’re a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.