Created
December 24, 2018 15:15
-
-
Save shsunmoonlee/f9549226d17ea1fed72077ff2a96ea71 to your computer and use it in GitHub Desktop.
functionDoesntCopyMap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function functionDoesntCopyMap() { | |
| let map = {1: 2, 2: 3} | |
| let val = 3 | |
| function functionCopiesValue(map, val) { | |
| map[1] -- | |
| val -- | |
| console.log("inner map, val", map, val) | |
| } | |
| console.log("======functionDoesntCopyMap") | |
| functionCopiesValue(map, val) | |
| console.log("outer map, val", map, val) | |
| } | |
| functionDoesntCopyMap() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment