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

Just genuinely curious, as I assume it's some bit of Javascript weirdness I don't know, but why the tostring rigmarole over "obj instanceof Array"


That's unreliable for client-side work because each frame has its own Array.prototype object which disavows instances that were created by code from different frames. It's a lot like Java classloaders, where if you aren't careful you can end up with several distinct and incompatible classes with identical names and (often) bytecode.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: