Hacker News new | past | comments | ask | show | jobs | submit login
Concepts for JavaScript developers to know (github.com/leonardomso)
88 points by wyclif on July 5, 2021 | hide | past | favorite | 12 comments



They 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.


OOP 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.


> 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.


Boilerplate on boilerplate on boilerplate.

Can you guess what my biggest problem with OOP is?


Code decoration?


console.trace() is also a nice declarative shortcut (may not be compatible with your logging setup, but convenient locally)


Sounds helpful. Any link you recommend to those unfamiliar with it that outlines the concept with helpful examples?


Here it is on MDN: 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.


With 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.



Symbols + 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()...


I 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.




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

Search: