Skip to content

Instantly share code, notes, and snippets.

@pvamshi
Last active August 29, 2015 14:20
Show Gist options
  • Save pvamshi/ceceb02ad32c5e6abfbc to your computer and use it in GitHub Desktop.
Save pvamshi/ceceb02ad32c5e6abfbc to your computer and use it in GitHub Desktop.
Pass by Value || Pass by Reference
function print(obj,str){
console.log("Object Name: "+obj.name);
console.log("String :"+str);
}
function changeValue(obj,str){
obj.name="something else";
str= "again something else";
str[0]='0';
}
var object1 = {};
object1.name = "Imaginea";
var str = "pramati";
print(object1,str);
changeValue(object1,str);
print(object1,str);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment