JavaScript is a programming language that is used to create interactive effects within web browsers. It is a versatile language that can be used to create a wide range of applications, from simple web pages to complex web applications. JavaScript is constantly evolving, with new features and updates being released regularly. In this article, we will take a look at some of the amazing new features that have been introduced in ES15, the latest version of JavaScript.
Optional chaining is a new feature in ES15 that allows you to access properties of an object without having to check if the object exists. This can be useful when working with nested objects, as it allows you to access properties without having to worry about whether or not they exist. Optional chaining is denoted by the question mark (?) operator, which can be used to access properties of an object that may be null or undefined.
The nullish coalescing operator is a new feature in ES15 that allows you to provide a default value for a variable if the variable is null or undefined. This can be useful when working with variables that may be null or undefined, as it allows you to provide a default value if the variable is not defined. The nullish coalescing operator is denoted by two question marks (??), and can be used to provide a default value for a variable if the variable is null or undefined.
Promise.allSettled is a new feature in ES15 that allows you to wait for all promises to settle, regardless of whether they are resolved or rejected. This can be useful when working with multiple promises, as it allows you to wait for all promises to complete before continuing with the rest of your code. Promise.allSettled returns a promise that resolves with an array of objects, each of which represents the outcome of a promise. The objects have a status property that indicates whether the promise was fulfilled or rejected, and a value property that contains the result of the promise if it was fulfilled.
The String.prototype.replaceAll method is a new feature in ES15 that allows you to replace all occurrences of a substring within a string. This can be useful when working with strings, as it allows you to easily replace all occurrences of a substring with another string. The String.prototype.replaceAll method takes two arguments: the substring to search for, and the string to replace it with. It returns a new string with all occurrences of the substring replaced with the replacement string.
Logical assignment operators are a new feature in ES15 that allow you to combine logical operators with assignment operators. This can be useful when working with variables that need to be updated based on a condition, as it allows you to update the variable in a single line of code. The logical assignment operators include the &&= operator, the ||= operator, and the ??= operator, which are used to update a variable based on a logical condition.
© 2025 Fahri Kurniawan.