Skip to content

Instantly share code, notes, and snippets.

@awilson28
Created March 16, 2017 19:54
Show Gist options
  • Save awilson28/d0dd4b3855500d9323c1bd2d0ca9b77a to your computer and use it in GitHub Desktop.
Save awilson28/d0dd4b3855500d9323c1bd2d0ca9b77a to your computer and use it in GitHub Desktop.
function changeStuff(num, obj1, obj2){
num = num * 10;
obj1.item = “changed”;
obj2 = {item: “changed”};
}
var num = 10;
var obj1 = {item: “unchanged”};
var obj2 = {item: “unchanged”};
changeStuff(num, obj1, obj2);
console.log(num); // 100
console.log(obj1.item); // ‘changed’
console.log(obj2.item); // ‘changed’
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment