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

Agreed, [].slice.call is show-offy and pointless. Array.prototype.slice.call is the way to go.

I hope you realize that by saving yourself a few characters you've sacrificed an unknown amount of performance from your site. For such a simple query I'd use getElementsByTagName instead.




>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: