Modal Title
Frontend Development / Open Source / Software Development

JavaScript Developers on What Matters and What’s Next

The latest release of JavaScript, ECMAScript 2022, was recently updated. We asked developers what were the most significant changes.
Oct 10th, 2022 8:33am by
Featued image for: JavaScript Developers on What Matters and What’s Next

More than 72% of companies are looking for JavaScript developers, according to Geeks for Geeks. That doesn’t seem to be changing any time soon, as the language continues to evolve.

“JavaScript keeps growing in popularity for web development and has been a cornerstone for the Jamstack ecosystem,” Jason Lengstorf,  vice president of Developer Experience at development platform Netlify, told The New Stack. “Companies are invested in moving the language forward because of its broad applicability to the builders of the web, which explains why many organizations have contributed to the language specification leading to the ES2022 release.”

The latest release of JavaScript, ECMAScript 2022, made eight updates in June. The New Stack asked developers to share what they thought were the most significant changes.

Netlify was particularly focused on how this release can help do more with serverless and edge functions, Lengstorf said.

“There are some pretty big (and somewhat controversial) inclusions such as top-level await, which is a welcome addition for many developers, but some experts see it as a footgun that will trip up devs who don’t know how it works under the hood,” Lengstorf said.

The top-level await feature will “delay the execution of current and parent modules until the imported module is loaded,” according to the ECMA 2022 language specification. It allows modules to use runtime values to determine dependencies and it can be used as a fallback for dependencies, according to the standard.

Lengstorf said that one thing he was happy to see was the .at() Method, which is now supported by Array, String, or TypedArray. This will support negative indexing of JS Arrays, which is something other programming languages already allow. It gives the ability to write arr[-1] instead of arr [arr.length-1], where negative numbers count backward from the last element, according to software engineer Brayan Arrieta’s blog.

“It’s a great little ergonomic boost to JavaScript syntax,” Lengstorf said.

Error Cause Features

Lengstorf also highlighted the introduction of a “cause” for thrown errors, saying it gives “library authors more pathways to create an excellent developer experience.”

Kris Kowal, a software engineer at Agoric, also pointed to the Error.cause features as a key upgrade. Agoric is a JavaScript-native smart contract platform and Proof of Stake blockchain.

In error.cause, the Error object and its subclasses now allow developers to specify which error caused the current exception, with the cause showing up in the stack trace and accessible via err.cause, according to the web developer Kai Wenzel’s synopsis of the standard changes.

“One feature that stands out is Error.cause,” Kowal told The New Stack. “ES2022 adds an idiom for expressing and inspecting serial causal dependency between errors, complementing AggregateError, which expresses causal dependency on parallel errors.”

These features together “enable reflection on error causality,” he said, which will eventually surface in developer tools. Couple that with libraries that will begin to take advantage of the ability to express error causality, and “developers will be more able to glean useful information about the root causes for failure.” Kowal added.

“Error.cause represents one of the best ways for JavaScript to evolve: to become more complete by filling in voids implied by the existence of other features,” he said.

Support for User Interfaces Creation

Part of the update helps developers speed the creation of user interfaces and includes new, “incredibly popular” UI widgets, said Baruch Labunski, CEO of the SEO company Rank Secure.

“One change was to allow migration to Angular for those who are on AngularJS because support for AngularJS is discontinued,” Labunski said. “Other popular programs received updates as well. Part of the update was because Microsoft is supportive of adding type syntax in JavaScript, helping programmers add type annotations to their JS code.”

Also critical: The update addressed two corrupted libraries that had malicious packages included in their original creation, Labunski said.

What’s Next?

Agoric holds a seat at the ECMAScript Table via Mark Miller, Agoric’s CTO and chief scientist, and also a member of the ECMAScript standards group since the mid-1990s, when he joined as Google’s delegate. (Watch for our upcoming interview with Miller about how E helped shape JavaScript.) Agoric uses a hardened version of JavaScript with its blockchain solution.

In the next iteration, Agoric would like to see Compartments support, Kowal said

“We will be excited to share more as first-class Module and ModuleSource arrive in the language, as well as features of Hardened JavaScript that allow us to safely invite guest programs to run in a shared realm,” he said.

Developer Shawn Wang, aka @ swyx, has documented the evolution of JavaScript and contends that JavaScript is in its third age. One change he is looking forward to is the temporal proposal, which is in stage three of the four-stage proposal process.

“That is probably the most highly anticipated upcoming feature, where essentially all the date formatting — like what does it mean to take today’s date and subtract a month?” Wang said. There’s all sorts of complicated date logic, including formatting but also including like date math, … Sometimes it’s a little ambiguous.”

Despite criticism of the language, JavaScript seems here to stay for the foreseeable future.

“Yes, it’s buggy, but it works,” Wang told The New Stack. “It runs everywhere. That is a huge, huge advantage to overcome. … Yes, if you have a domain-specific language for [a] particular new platform and device where nothing else runs, [then] sure, you can make your own language. But beyond that, JavaScript just runs with everything.”

Group Created with Sketch.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.