var o = function() {
}
o.extend = function() {
var args = arguments[0];
if (args != null) {
for (arg in args) {
this[arg] = args[arg];
}
}
}
o.extend({x: "I am x", y: "I am y"});
console.log(o.x);
console.log(o.y);
Output:
I am x I am y
No comments:
Post a Comment