Umajin 4.1.0 brings the QuickJS JavaScript Engine. This is a major upgrade to the built-in JavaScript capabilities. So far Umajin has relied on the Duktape JavaScript Engine which was limited to ES5, plus a few cherry picked features from ES2015 and ES2016. Duktape has definitely served us well, but JavaScript has been through a lot of changes in recent years, and JavaScript developers expect a lot more.
QuickJS supports (almost) the full ES2020 spec, and boasts close to a 100% pass rate of the ECMAScript Test Suite. For more information on QuickJS itself you can visit https://bellard.org/quickjs/
A lot of work has gone into making sure the upgrade to QuickJS is as seamless as possible. There are no changes to the Umajin JavaScript API, so your existing apps should continue to function as expected. The JavaScript engine itself is the only part of the JavaScript environment that has changed. In most cases, Umajin developers should not even notice the change for an existing app. But going forward, it is now possible to take advantage of modern JavaScript, and even have more reliability when using third party JavaScript libraries.
While care has been taken to make sure this update is backward compatible with existing Umajin projects, there are some things to take note of.
The const keyword
Probably the most common thing to note is that the const keyword was not enforced in the old engine, but now it is. This means any code that redefines or modifies the value of a const variable would have been working before, but now will throw an error.
You must also be aware that JavaScript files in the root of your projects /scripts directory are all executed in the same global scope when the app starts. This means that global const variables across different files can actually clash with each other. This can be common when using const to keep a reference to a module after a require.
ES6 modules
QuickJS supports the ES2020 spec, but ES modules are probably the most notable missing feature. However, Umajin still support loading CommonJS module files using require, just like it always has.
ES modules are still planned for a future update though, so keep an eye out for that.
Mathematical types
QuickJS has mathematical extensions that add support for bigint, as well as BigDecimal and BigFloat, but they have not been enabled in the current release due to compatibility.
Component reference types have changes
The datatype of Umajin Component references in JavaScript is now an Object. Previously it was a Number. This should not affect the normal use of components, unless you are using these references for something that can not be an object, like as keys of an object for example.
New language features
Most ES2020 syntax is now supported. For a list of the biggest changes to the language take a look at this ES2015/ES6 guide: https://www.javascripttutorial.net/es6/. For a quicker summary, it is definitely worth taking a look at Modern Javascript: Everything you missed over the last 10 years by Sandro Turriate.