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

That's exactly what I was thinking:

* In the first version each time the anonymous function is executed interpreter has to lookup String and from it the fromCharCode method => 2n lookups.

* In the second version the String and fromCharCode have to be lookud up only once => 2 lookups.

Therefore according to slow-lookups-theory the first version should be slower. Except when I measure it, the opposite turns out to be true.



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

Search: