map() creates a new array from calling a function for every array element. It does not execute the function for empty elements or change the original array. JavaScript Map is a collection of key-value pairs, enabling efficient data retrieval and manipulation....
Sets in JavaScript are collections of unique values, meaning no duplicates are allowed. They provide efficient ways to store and manage distinct elements. Sets support operations like adding, deleting, and checking the presence of items, enhancing performance for tasks requiring uniqueness....
Closures in JavaScript are functions that retain access to variables from their containing scope even after the parent function has finished executing. They’re useful for maintaining private data, creating modular code, and implementing callback functions with persistent state. In this article, we’ll dive deep into closures, understand how they work, and explore practical examples....
The Array filter() is an inbuilt method, this method creates a new array with elements that follow or pass the given criteria and condition. Few Examples have been implemented below for a better understanding of the concept Syntax:...
The following approach covers how to replace the names of multiple object keys with the values provided by the user using JavaScript....
When working with arrays, it’s widespread to iterate through its elements and manipulate them. Traditionally this can be done using for, while or do-while loops. The forEach will call the function for each element in the array....
In this article, we will see what is Block scoping in Javascript, access to the block-scoped variables, how it is distinct from other kinds of variable’s scope, through the examples. Prior to ES2015, JavaScript supported only function-level scoping unlike other languages like C++/Java which has block-level scoping. With ES2015, in addition to function-level scoping, JavaScript also supports block-level scoping with the help of the let keyword & const keyword....
To know the difference between Microtask Queue and Callback Queue, we need to have a clear idea of how does asynchronous JavaScript gets executed and what are the roles that Microtask Queue and Callback Queue play....
ES2015 is the latest version of JavaScript programming language. It is the first major upgrade to JavaScript since 1997. It was approved in June 2015 by ECMA international, an association responsible for approving ECMA standards which programming languages like JavaScript, CoffeeScript and TypeScript follows. The name of this version of JavaScript has undergone multiple changes starting from Harmony to ES6 to ES2015. Before ES2015, ECMAScript was named after version numbers. It was only recently that it was decided that it will be named according to the year of release. Thus the name changed from ES6 to ES2015....
The task is to convert a JavaScript Object into a plain ES6 Map using JavaScript. we’re going to discuss a few techniques. To understand the difference between a map and an object please go through the Map vs Object in JavaScript article....