Hacker News new | comments | show | ask | jobs | submit login

>Array.prototype.slice.call is the way to go.

The point was to demonstrate that the API is somewhat flawed since it doesn't return something usable. The "clever" short version was used to show that you have to write quite a bit more code - even if you make it really ugly.

>For such a simple query I'd use getElementsByTagName instead.

It's a generic example. The selector was kept short and simple for the sake of brevity.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: