Created
November 2, 2020 14:17
-
-
Save mnzit/2bf8629a316073e15d89ea0ed298b9db to your computer and use it in GitHub Desktop.
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 changeStuff(a, b, c) { | |
| a = a * 10; | |
| b.item = "changed"; | |
| c = { item: "changed" }; | |
| } | |
| var num = 10; | |
| var obj1 = { item: "unchanged" }; | |
| var obj2 = { item: "unchanged" }; | |
| obj2 = { item: "changed" } | |
| changeStuff(num, obj1, obj2); | |
| console.log(num); | |
| console.log(obj1.item); | |
| console.log(obj2.item); | |
| function addStuffInArray(array) { | |
| array.pop(); | |
| console.log(array); | |
| array = [1,2,3]; | |
| } | |
| let array = [1, 2, 3, 4, 5]; | |
| let arrayReferenceCopy = array; | |
| arrayReferenceCopy.pop(); | |
| addStuffInArray(array); | |
| console.log(array); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment