Here's a fun challenge: in , how do you determine whether a given value is an object literal (or equivalently plain object)?

@joepie91 Object.getPrototypeOf(target) === Object.getPrototypeOf({}) ?

Follow

@miyuko Nope! This will break on cross-realm objects (eg. from a worker thread) and null-prototype objects

· · Web · 0 · 0 · 0
Sign in to participate in the conversation
Pixietown

Small server part of the pixie.town infrastructure. Registration is closed.