ES15 / ECMAScript 2024 Javascript

10. A Deep Dive into the Latest JavaScript Features — ES15 Javascript

✅ open src 🚀 🚀
6 min readFeb 16, 2024

--

ES15 JavaScript
ES15 JavaScript

JavaScript has evolved a lot and is one of the most widely used languages in the world. We’ll delve into some of the key features of Javascript ES15 / ECMA 2024 / ECMAScript 2024, the iteration of the ECMAScript standard.

Let’s Start…

1. Well-formed Unicode Strings in ES15 Javascript

This feature aims to improve how JavaScript handles Unicode strings. We have 2 methods one is toWellFormed and other one is isWellFormed.

const str1 = "Smile-Please\uD83D\uDE00";
const str2 = "No\uDC00Smile";

console.log(str1.isWellFormed()); // true
console.log(str1.toWellFormed()); // "Smile-Please😀"

console.log(str2.isWellFormed()); // false
console.log(str2.toWellFormed()); // "No�Smile"

Use of Well-formed Unicode string in the URL.

const invalidURL= "https://www.website.com/query=\uDC00data";

encodeURI(invalidURL); // Expected: URIError: URI malformed

encodeURI(invalidURL.toWellFormed()); // Expected output: "https://yourfuse.com/query=%EF%BF%BDdata"
  • The variable invalidURL contains a URL with a \uDC00.
  • Attempting to encode this URL with encodeURI()

--

--

✅ open src 🚀 🚀

1. Open source contributor, Architect at Jio Platform Ltd. and The Author of fe-pilot. https://github.com/opensrc0/fe-pilot/