Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gulshanzealous
Last active July 10, 2020 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gulshanzealous/15d98e8487f920c9e59b37ccf34394d7 to your computer and use it in GitHub Desktop.
Save gulshanzealous/15d98e8487f920c9e59b37ccf34394d7 to your computer and use it in GitHub Desktop.
// source https://jsbin.com
"use strict";
var arr = [9, 4];
var myMap = new Map();
myMap.set("name", arr);
var newMap = new Map(myMap);
// newMap.set("name","shraddha")
arr.push(5);
myMap.forEach(function (value, key) {
console.log(key + " : " + value);
});
newMap.forEach(function (value, key) {
console.log(key + " : " + value);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment