Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
6 views

JavaScript Interview

JavaScript Interview Questions

Uploaded by

Jeesmon shaju
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

JavaScript Interview

JavaScript Interview Questions

Uploaded by

Jeesmon shaju
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

NEW

FEATURES
JAVASCRIPT
ACE YOUR
INTERVIEW
JavaScript New Features

1. Nullish Coalescing (??)

The ?? operator returns the right-side value if the left-


side value is null or undefined; otherwise, it returns the
left-side value. It’s useful for setting default values.
JavaScript New Features

2. globalThis

globalThis provides a standard way to access the global


scope across different environments (browser,
Node.js, etc.).
JavaScript New Features

3. matchAll()

matchAll() returns an iterator for all matches of a


regular expression in a string, including capture groups.
JavaScript New Features

4. Promise.allSettled()

Promise.allSettled() waits for all promises to settle


(fulfilled or rejected) and returns an array with each
promise's outcome.
JavaScript New Features

5. Error Cause

The cause property allows you to include the original


error when throwing a new error, providing more
context.
JavaScript New Features

6. Private Methods and Fields

Private fields and methods, denoted with #, are


accessible only within the class where they are defined.

Attempting to access counter.#count directly would


result in an error.
JavaScript New Features

7. await Operator at the Top Level

Top-level await allows the await keyword to be used


outside of an async function in ES modules, making
asynchronous operations simpler in module scripts.
JavaScript New Features
8. Object.hasOwn()

Object.hasOwn() is a safer way to check if an object has


a specified property, as it avoids issues with overridden
hasOwnProperty.
JavaScript New Features
9. Native Array groupBy

The groupBy() method groups array items by a specified


criterion, returning an object where each key represents
a group.
JavaScript New Features
10. Resolve Promise with Promise.withResolvers()

Promise.withResolvers() simplifies creating a promise


that can be resolved or rejected outside its initial scope,
providing an object with the promise, resolve, and
reject properties.

You might also like