4 ms·
Concepts for JavaScript developers to know
- austincheney 5y agoThey didn’t mention new Error().stack That is a de facto standard for creating a call stack anywhere without interruption. There were several things on that list you never need. 14-18 is for OOP which is fully optional in the language.
- dstick 5y agoSounds helpful. Any link you recommend to those unfamiliar with it that outlines the concept with helpful examples?
- austincheney 5y agoHere it is on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/Stack https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... Despite the warning at the top of the article the convention is widely available cross browser and in terminal runtimes like Node.
- Normal_gaussian 5y agoWith respect to the warning, MDN has a compatibility table at the bottom which shows full support on all tracked systems since very early version numbers.
- schwartzworld 5y agoOOP is optional, but so are all other paradigms. You get the cleanest code when you have the most tools for describing what you want to do to the computer. Most JS devs just use arrays for everything.
- tomxor 5y ago> OOP is optional I wish this was more widely understood (that's it's merely a pattern, not an inevitability), so much OOP code is just bags of arbitrary stuff. It's not an inherently bad pattern, just often misused.
- bluefirebrand 5y agoBoilerplate on boilerplate on boilerplate. Can you guess what my biggest problem with OOP is?
- austincheney 5y agoCode decoration?
- winrid 5y agoconsole.trace() is also a nice declarative shortcut (may not be compatible with your logging setup, but convenient locally)
- lennoff 5y agoIteration protocols[1] are also nice (`Symbol.iterator`[2] and `Symbol.asyncIterator`[3]) [1]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... [2]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... [3]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/asyncIterator https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- winrid 5y agoSymbols + Maps have some neat gotchas that are good to be aware of. For example, if you use Symbols as keys in an object, Object.keys() or for...of/in will NOT return/iterate over those keys. You have to use Object.getOwnPropetySymbols()...
- wruza 5y agoI skimmed through it too quickly, but it seems that most of these links are rehash of ES6 spec, which is pretty technical but understandable. If you have no issue with technical details and (like me) do not want narrative, you may refer to it as well.
- deleted 5y ago[deleted]