by erikpukinskis · 12y ago · 0 comments
> it's important that anyone you hire has a comprehensive knowledge of apply and call
To other Javascript developers: is this really true? I do use call every now and then, but it's pretty rare. Maybe that kind of stuff is more important if you're trying to functionally isolate components with richer interfaces between them? I tend to keep a pretty polluted namespace, so maybe that's where I'm going wrong.
That said, I have a "I could learn that but I have stuff to ship" mindset about Javascript. That has its ups and downs. Maybe I should work on that a bit more.
Even in the "front end development" subfield of web development, there are divisions. Do you want someone to produce lots of modular libraries that are reusable throughout your company/application suite, or perhaps to build a UI framework? Then knowledge of these parts of JavaScript will be very useful. Do you want someone to build a rich internet application in Meteor? Then knowledge of positioning, layouts, templates, UI effects and how to tie them into the Meteor framework is much more valuable.
Where I work we do a lot of 2D animations, so it's great if the people who work here know all about CSS transitions, requestAnimationFrame, and so on.
You can do a lot of things with higher-order functions just by making closures, but `apply` and `call` will give you flexibility and power there's no other way to get. For one thing, they're your ticket to manipulating `this`.
The worst part is keeping them straight. My mnemonic is that `call` is just a function call, so arguments go in as normal. `apply` is the other one, so arguments go in as an array. (Maybe "A" for array, or something.)
amen bro...amen.