Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 2133

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 61k
Author
Asked: November 26, 20242024-11-26T02:35:08+00:00 2024-11-26T02:35:08+00:00

New Features in ES2023

  • 61k

New Methods in Array.prototype – Copy Array

The reverse(), sort() and splice() methods on Array.prototype mutate the array in place. To avoid the mutation es2023 introduced the equivalent methods that returns the copy of the array on which these operations are performed.

toReversed() method

const original = [1, 2, 3, 4]; const reversed = original.toReversed();  console.log(original); // [ 1, 2, 3, 4 ]  console.log(reversed); // [ 4, 3, 2, 1 ] 
Enter fullscreen mode Exit fullscreen mode

toSorted(compareFn) method

const original = [1, 3, 2, 4]; const sorted = original.toSorted();  console.log(original); // [ 1, 3, 2, 4 ]  console.log(sorted); // [ 1, 2, 3, 4 ] 
Enter fullscreen mode Exit fullscreen mode

toSpliced(start, deleteCount, …items) method

const original = [1, 4]; const spliced = original.toSpliced(1, 2);  console.log(original); // [ 1, 4 ]  console.log(spliced); // [ 1, 2, 3, 4 ] 
Enter fullscreen mode Exit fullscreen mode

with(index, value) method

const original = [1, 2, 3, 4]; const withThree = original.with(2, 5);  console.log(original); // [ 1, 2, 3, 4 ]  console.log(withThree); // [ 1, 2, 5, 4 ] 
Enter fullscreen mode Exit fullscreen mode

Use of Symbols as WeakMap Keys

In JavaScript, Objects and Symbols are guaranteed to be unique and cannot be re-created, which makes them both great candidates for the WeakMap keys. Previous versions or specifications allowed only Objects to be used that way, but in es2023 we can use Symbols as the WeakMap key.

const weak = new WeakMap(); const key = Symbol("ref"); weak.set(key, "ECMAScript 2023");  console.log(weak.get(key)); // ECMAScript 2023 
Enter fullscreen mode Exit fullscreen mode

Array find from last

es2023 adds findLast() and findLastIndex() methods on Array and TypedArray prototype. They are similar to find() and findIndex() but iterates over items in reverse order.

const isEven = (number) => number % 2 === 0; const numbers = [1, 2, 3, 4];  // from first to the last lookup console.log(numbers.find(isEven)); // 2 console.log(numbers.findIndex(isEven)); // 1  // from last to the first lookup console.log(numbers.findLast(isEven)); // 4 console.log(numbers.findLastIndex(isEven)); // 3 
Enter fullscreen mode Exit fullscreen mode

Hashbang Grammar

Hashbang, also known as a shebang is a sequence of characters at the beginning of an executable script that defines the interpreter for the program to be run on.

#!/usr/bin/env node  console.log('hello'); 
Enter fullscreen mode Exit fullscreen mode

With this change we would not require to invoke a file explicitly using node interpreter as node <file-path>

These new features will going to be very handy in lots of use cases. Hope you find it useful and are eagerly waiting to use these features in your upcoming projects.😀

discussjavascriptnewswebdev
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 2k
  • Popular
  • Answers
  • Author

    ES6 - A beginners guide - Template Literals

    • 0 Answers
  • Author

    Understanding Higher Order Functions in JavaScript.

    • 0 Answers
  • Author

    Build a custom video chat app with Daily and Vue.js

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.