5 ms·
> You can use Object.getOwnPropertyNames to get all the properties defined on an object. This might be a nice alternative to a for in loop. Careful. These have
by wging 12y ago
> You can use Object.getOwnPropertyNames to get all the properties defined on an object. This might be a nice alternative to a for in loop.
Careful. These have different behavior for own properties which are not enumerable. A for-in loop doesn't include them, but Object.getOwnPropertyNames does.
- TazeTSchnitzel 12y agoRight Object.keys(foo) is better.
- btipling 12y agoAnd I also missed out on including this, thank you.
- btipling 12y agoNice catch, I will update the blog post.