Why Communication Skills Is An Important Skill For DevelopersMay 30, 2022
Help! I’ve Had To SSH Into A Linux Box (Part 2)June 13, 2022
It is a dynamically typed language, which means variables are assigned a type at runtime based on their value. Much like other dynamically typed languages, this opens up a great deal of possibilities to what you can do with data manipulation in your code.
This article highlight some of these language features which fall into 3 categories:
Make your life easier (W)
Unique array records (W)
Quick type conversions (W)
As mentioned above, JS is a dynamically typed language which makes type conversion, although strange, but very easy and kind of wonderful
Array/Object manipulation (W)
Having to work with objects of data, not just in JS but other languages. Often times to find yourself having to loop of these objects, nest some of those loops with some conditions. While some of these object manipulation tricks are popular and familiar in JS, here’s a few unpopular ones I’ve found to be very nifty.
ES2020 language features (B)
A special JS numeric type that provides support for integers of arbitrary length.
Allows us to truly and correctly check for nullish values (
undefined) instead of falsey values.
Optional chaining allows us to access deeply nested object properties without worrying if the properties exist or not. This is useful especially if you’re not sure what the data looks like or it does not have a consistent structure.
this object that always refers to the global object, no matter where you are in you code scope.
Promise.all() which resolves only when all promises passed to it resolve else rejects with the first rejected promise error,
Promise.allSettled always get resolved with an array having info about all the promises passed to it, whether resolved or rejected.
Used to import JS files dynamically as JS modules in your code
The Weird Stuff (L)
As mention, JS a is dynamically typed language. So this opens up a room for a lot error when it comes types and their interpretation.
Hers’s a few honorable mentions that make JS what many would define as annoying but I just find hilarious and very quirky.
You can find more of these on denysdovhan/wtfjs.
I have not been heavily involved in front-end development lately and so many thing mentioned above may not be entirely correct/accurate anymore. If you do spot something that may have changed or forgot to mention, please highlight it in a comment below.