Last active
August 29, 2015 14:20
-
-
Save pvamshi/ceceb02ad32c5e6abfbc to your computer and use it in GitHub Desktop.
Pass by Value || Pass by Reference
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 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