AmitDiwan has Published 10740 Articles

Array.prototype.flat() in JavaScript.

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 08:47:46

151 Views

The JavaScript Array.prototype.flat() method is used to flatten an array recursively up to a specified depth. It doesn’t manipulate the original array but creates a new flattened array.Following is the code for the Array.prototype.flat() method −Example Live Demo Document    body {       font-family: ... Read More

Array.prototype.flatMap() in JavaScript.

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 08:45:19

175 Views

The JavaScript Array.prototype.flatMap() function flattens the given nested array into a new flat array.Following is the code for the Array.prototype, flatMap() method −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {     ... Read More

Explain Optional Catch Binding in JavaScript.

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 08:41:45

471 Views

The optional catch binding introduced in ES2019 allows us to remove the surrounding parentheses of a catch binding i.e. we don’t need to use a variable to store the error object. It is useful especially if we know about the error in advance or even if want to react to ... Read More

Explain String.trimStart() & String.trimEnd() methods in JavaScript

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 08:38:55

523 Views

The String.trimStart() method is used to remove whitespace from the string beginning while the String.trimEnd() method removes whitespace from the end of the string.Following is the code for the String.trimStart() and String.trimEnd() methods −Example Live Demo Document    body {       font-family: "Segoe UI", ... Read More

Object.fromEntries() method in JavaScript.

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 08:36:28

185 Views

The Object.fromEntries() method in JavaScript is used for converting an iterable like an array, map having a key value pair into an object.Following is the code for the Object.fromEntries() method −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, ... Read More

array.flatmap() method in JavaScript.

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 08:33:50

138 Views

The JavaScript array.flatMap() function flattens the given nested array into a new flat array.Following is the code for the array.flatMap() method −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       ... Read More

Array.flat() method in JavaScript.

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 08:28:19

197 Views

The JavaScript Array.flat() method is used to flatten an array recursively up to a specified depth. It doesn’t manipulate the original array but creates a new flattened array.Following is the code for the Array.flat() method −Example Live Demo Document    body {       font-family: ... Read More

Array.prototype.includes() method in JavaScript.

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 08:22:13

210 Views

The JavaScript Array.protoype.includes() method is used to check if an array contains a given element or not.Following is the code for the Array.protoype.includes() method −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample { ... Read More

Const vs Let in JavaScript.

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 08:19:57

1K+ Views

Const and let were introduced in ES2015 to declare block scoped variables. While variables declared using let can be reassigned, they cannot be reassigned if they were declared using const.Following is the code showing let and const in JavaScript −Example Live Demo Document    body { ... Read More

How to declare Block-Scoped Variables in JavaScript?

AmitDiwan

AmitDiwan

Updated on 16-Jul-2020 08:14:16

245 Views

To declare block scoped variables, we use the keyword let and const introduced in ES2015.Following is the code showing declaring black scoped variables in JavaScript −Example Live Demo Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result, ... Read More

Advertisements