What New JavaScript Proposals Are Shaping the Future of Web Development?
The article reviews recent TC39 proposals—including Private‑in, Object.hasOwn, Realms, Array.findLast, ArrayBuffer Base64, and Array.groupBy—explaining their stage progress, technical details, usage examples, and potential impact on modern JavaScript development.
In July the TC39 meeting concluded with several proposals advancing: private‑in and Object.hasOwn reached Stage 4, while Realms, Array.findLast, ArrayBuffer‑Base64, and Array.groupBy entered Stage 3, soon to appear in developer browsers and Node.js.
Stage 3 → Stage 4 Requirements
All proposal content must have corresponding test262 tests, which have already been added.
At least two implementations must pass the tests and ship in a formal release.
A pull request merging the proposal into the ECMAScript specification must be signed by the ECMA editors.
Private Fields In Operator
The in operator can now test whether a class private field exists on an object, avoiding the need for try { obj.#foo } catch {} patterns. It distinguishes between a missing field and an access error.
class C { static isC(obj) { try { obj.#getter; return true; } catch { return false; } } } class C { static isC(obj) { return #brand in obj && #method in obj && #getter in obj; } }The proposal does not change the semantics of #field; fields remain private to their lexical scope and are not accessible across realms.
Accessible Object.hasOwn
The new Object.hasOwn method provides a safe way to check an object's own properties without risking overridden hasOwnProperty implementations.
let hasOwn = Object.prototype.hasOwnProperty;
if (hasOwn.call(obj, "foo")) { console.log("has property foo"); } Object.hasOwn({ foo: false }, "foo"); // true
Object.hasOwn(Object.create({ foo: true }), "foo"); // falseArray.findLast
This proposal adds Array.prototype.findLast and Array.prototype.findLastIndex (and analogous TypedArray methods) that search from the end of the array.
const array = [{value:1},{value:2},{value:3},{value:4}];
array.findLast(n => n.value % 2 === 1); // {value:3}
array.findLastIndex(n => n.value % 2 === 1); // 2Realms
Realms introduce a new API for executing JavaScript in isolated global environments, similar to a sandbox.
class Realm { constructor(); importValue(specifier, bindingName); evaluate(sourceText); }Only primitive values and callables can cross realm boundaries. The API enables use‑cases such as web‑based IDEs, DOM virtualization, testing frameworks, mock tools, plugin mechanisms, sandboxing, server‑side rendering, and code editors.
Stage 2 → Stage 3 Requirements
The proposal must have a complete spec text reviewed and signed by TC39 members.
The ECMA editors must sign off on the proposal.
Stage 0 → Stage 1 Requirements
Find a TC39 champion.
Clearly state the problem, need, and a rough solution.
Provide examples of the issue and the solution.
Discuss API shape, algorithms, semantics, and implementation risks.
ArrayBuffer to/from Base64
This proposal adds ArrayBuffer.toBase64 and ArrayBuffer.fromBase64 methods, supporting RFC 4648 base64 and a URL‑safe variant.
let buffer = new TextEncoder().encode('hello');
console.log(buffer.toBase64()); // 'aGVsbG8='
buffer = ArrayBuffer.fromBase64('aGVsbG8=');
console.log(buffer.byteLength); // 5Array Grouping
The proposal brings lodash‑style _.groupBy to ECMAScript as Array.prototype.groupBy.
const array = [1,2,3,4,5];
array.groupBy(i => i % 2 === 0 ? 'even' : 'odd');
// => { odd: [1,3,5], even: [2,4] }Conclusion
The JavaScript Chinese Interest Group (JSCIG) invites developers to discuss these and other ECMAScript topics on GitHub: esdiscuss .
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Taobao Frontend Technology
The frontend landscape is constantly evolving, with rapid innovations across familiar languages. Like us, your understanding of the frontend is continually refreshed. Join us on Taobao, a vibrant, all‑encompassing platform, to uncover limitless potential.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
