Method 5 : Map Objects
In JavaScript, a Map object holds key-value pairs, allowing any type of key, unlike objects. It maintains order and provides methods for manipulation and retrieval.
Syntax:
let map1 = new Map();
Example: Here is thew basic example of map object.
Javascript
let map1 = new Map(); map1.set( "FirstName" , "Rohit" ); map1.set( "LastName" , "Sharma" ); map1.set( "website" , "w3wiki" ); console.log(map1); |
Output
Map(3) { 'FirstName' => 'Rohit', 'LastName' => 'Sharma', 'website' => 'w3wiki' }
JS 2015 or ECMAScript 6 (ES6)
JS 2015 (ES6) also known as ECMAScript 6 (ES6), ECMAScript 6 (ES6) is a significant update to JavaScript, introducing arrow functions, classes, template literals, let and const for variable declaration, enhanced object literals, destructuring, and more modern features for better code organization and readability.
Contact Us