Let's go through some of the new features that we're getting from this version 👇
🔸 String.prototype.replaceAll()
The current 'String.prototype.replace()' method only replaces the first occurrence, unless a regular expression with a global modifier is provided.
With the new 'String.prototype.replaceAll()' method, we can finally omit the regex 👇
🔸 Private Methods
When a method name starts with '#', we declare them private.
Private methods can only be accessed from within the class they're defined 👇
🔸 Private Accessors
Similar to Private Methods, accessor functions can be made private by prepending # to the function name as well 👇
🔸 Promise.any()
You probably already know how to use 'Promise.all()' to await all Promises from a list to resolve.
With Promise.any(), we can await a list of Promises, but resolve as soon as one of the Promises in the list resolves 👇
🔸 Logical Assignment Operator (&&)
The new Logical Assignment Operator combines logical operations (&& / || / ??) with assignments.
Let's take a look below, using && 👇
🔸 Logical Assignment Operator (||)
Similarly, we can use the new Logical Assignment Operator with || 👇
🔸 Logical Assignment Operator (??)
Finally, we can use it in combination with the Nullish Coalescing Operator 👇
There are two additional new features, 'WeakRef' and 'Finalizers', which are a bit too complex to explain here.
But I highly recommend looking them up!
What do you think of these new features? 🤩
Will you be using them?
Share your thoughts below 👇
• • •
Missing some Tweet in this thread? You can try to
force a refresh
Learn JavaScript 🔥
It's the safest bet you can do.
You can build almost anything with it:
🔹 Front End
🔹 Back End
🔹 Mobile Apps
🔹 Desktop Apps
🔹 Machine Learning
🔹 DevOps
Let's go through them 🧵👇
🔹 Front End
This one should be obvious.
JavaScript was built for the Front End.
With the rise of libraries and frameworks such as React, Vue, Angular, and Svelte, JavaScript has become the one and only preferred language to build interactive Front Ends for the web.
🔹 Back End
You've probably heard of NodeJS.
NodeJS is a tweaked version of the V8 engine that lets it access the filesystem.
This enables JavaScript to run on a server.
Its event-driven, asynchronous nature makes it pretty good at it as well 🔥
> You should never offer your work for free.
> Don't use Upwork or Fiverr.
> Use value-based pricing, not hourly or fixed pricing.
Let me explain why these statements are wrong 🧵👇
👉 You should never offer your work for free.
This will signal your "worth" and your "value".
It's also a perfect way to drive your market prices to the bottom, taking everyone down with you.
These are arguments that you often hear.
Well, if no one is going to hire you, you are already worth nothing. Zero. Per definition. No money is coming your way.
Offering your work for free is a terrific way to build up initial customer relationships and reputation!
Ask for a review in return instead of compensation.
14 Array Methods that will make your life easier.
Explanation and examples below.
🧵👇
🔸 map
The map() method creates a new array populated with the return value of the callback function for each element in the array.
🔸 forEach
The forEach() method executes a provided function once for each array element.
The callback function does not expect a return value, and the forEach() method itself also returns undefined.