Object.prototype.foo=function(obj){for(var i in obj) this[i]=obj[i]} obj={a: 1} testObj={} testObj.foo(obj) alert(testObj.hasOwnProperty("foo"))