Created
March 16, 2017 20:10
-
-
Save awilson28/a7231ffd3428866d7e69959d6a186184 to your computer and use it in GitHub Desktop.
This file contains 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(num, obj1, obj2){ | |
num = num * 10; // num is the value 10; once passed to the function, it has no relation to the variable `num` outside the function | |
obj1.item = “changed”; | |
obj2 = {item: “changed”}; | |
} | |
var num = 10; | |
var obj1 = {item: “unchanged”}; | |
var obj2 = {item: “unchanged”}; | |
changeStuff(num, obj1, obj2); | |
console.log(num); // 10 | |
console.log(obj1.item); // ‘changed’ | |
console.log(obj2.item); // ‘unchanged’ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment