Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Sometimes it would be awfully convenient to stash some extra data on a JavaScript object that really belongs to someone else.

Convenient yes, a good idea, no.

> Other code using for-in or Object.keys() may stumble over the property you created.

> The standard committee may decide to add an .isMoving() method to all elements. Then you’re really hosed!

So I dunno, maybe don't stash properties into an object that doesn't belong to you? It's this sort of thing that makes me hate the culture around JavaScript. Hacks upon hacks upon hacks just to save a little effort.



I don't see why they didn't just use an Object/dictionary. Shouldn't be slow to iterate and solves this exact use case.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: