Hacker News new | ask | show | jobs
by saagarjha 2071 days ago
> Technically, accessing a variable is simply faster than a property access on an object

A good compiler will make it so that they are largely equivalent. In C-based languages this is one of the first things a compiler will do, and I am sure that every JavaScript engine does this kind of thing too when possible (actually, it may even have an easier time doing it because it may be able to skip pointer analysis).