7

ECMAScript 2023 spec for JavaScript adds methods for arrays

 1 year ago
source link: https://www.infoworld.com/article/3692809/ecmascript-2023-spec-for-javascript-adds-methods-for-arrays.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

ECMAScript 2023 spec for JavaScript adds methods for arrays

ECMAScript 2023, due in June, is set to add new methods for searching and changing arrays, allow symbols to be used as WeakMap keys, and standardize support for hashbang grammar.

By Paul Krill

Editor at Large,

InfoWorld | Apr 5, 2023 11:33 am PDT

shutterstock 1361674454 JavaScript Hello code in programming text editor

Bigc Studio / Shutterstock

ECMAScript 2023, the next planned update to the official specification for the JavaScript programming language, is slated to add four capabilities in areas such as arrays and WeakMap keys, based on a list of finished proposals.

The finished proposals, published by the ECMA TC39 (Technical Committee 39) on GitHub, mark the following four features to be published this year:

  • Array find from last, a proposal for .findlast() and .findLastIndex() methods on array and typed array. Finding an element in an array is a very common programming pattern, the proposal states. Scenarios under which this feature would be used include when a developer knows that finding an element from last to first may have better performance, or developers care about the order of the elements.
  • Permitting symbols as keys in WeakMap keys, a proposal that extends the WeakMap API to allow the use of unique symbols as keys. Currently, WeakMaps are limited to allow only objects as keys.
  • Change array by copy, a proposal that provides additional methods on Array.prototype and TypedArray.prototype to enable changes on the array by returning a new copy of it with the change.
  • Hashbang grammar, a proposal to match the de facto usage in some CLI JS hosts that allow for Shebangs/Hashbang. These hosts strip the hashbang to generate valid JS source texts before passing to JS engines. This plan would move the stripping to engines and unify and standardize how that is done.

Updated versions of ECMAScript traditionally are finalized by ECMA in June. Last year’s ECMAScript 2022 featured class elements and top-level await capabilities.

Paul Krill is an editor at large at InfoWorld, whose coverage focuses on application development.

Follow

Copyright © 2023 IDG Communications, Inc.

Sponsored Links


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK