Skip to content

Instantly share code, notes, and snippets.

@santosh79
Last active August 29, 2015 14:22
Show Gist options
  • Save santosh79/e7cffe38b65722330c4e to your computer and use it in GitHub Desktop.
Save santosh79/e7cffe38b65722330c4e to your computer and use it in GitHub Desktop.
var a = {
getVal: function() {
return this.val;
},
setVal: function(val) {
this.val = val;
}
};
function printVal() {
console.log("The value of A: " + a.getVal());
}
a.setVal(10);
printVal(a);
a.setVal(20);
a.setVal(30);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment