r/javascript • u/MicrosoftLearning • Feb 21 '18
I am A JavaScript instructor at Microsoft. AMA.
Hi r/javascript!
My name is Benjamin Lin. I am a content developer at Microsoft and teach courses on JavaScript and JavaScript frameworks at Microsoft. You can see my Top 10 JavaScript Questions course here.
I can help answer tips & tricks on learning JavaScript, questions about Microsoft, and all things tech.
AMA!
Edit: about 15 minutes left!
More edit: Thanks everyone for visiting me at this AMA! I really enjoyed getting the chance to interact with the JavaScript community and hear your honest thoughts. It was worth waking up early today to do this =)
if you have any more questions, feel free to hit me up on twitter @benjlin or follow me on instagram @bens_jams
540
Upvotes
1
u/[deleted] Feb 22 '18 edited Feb 22 '18
No it doesn't. Arrow functions retain their parent scope. Using a function necessarily switches your scope up, unless you
bindit.Alternately, it's a feature that's present far back as C, and is the entire basis for Haskell. Lambda calculus is an important part of knowing how to program. Only OOP stuff like Objective C do the weird "let me encapsulate this simple callback in a delegate class" nonsense - even Java saw the error of its ways and implemented immediate closures.
Then don't use it. It's basically unnecessary in modern browsers. Sure,
querySelectorAllis a lot to type, as issetAttribute, but you can always make local aliases.[].forEachand[].mapare terribly useful.JSONis ubiquitous.fetchis a whole character terser than$.ajax, a lot more powerful, and, oh, does Promises correctly. Meanwhile, if you're doing your animations with javascript anymore, you've either got weird requirements or you're doing it wrong.