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
//this accesses the object | |
//callee.caller only gets the function that called it. | |
function dookie(pooper){ | |
console.log('plop'); | |
pooper.speak(); | |
} | |
function dookie2() | |
{ | |
console.log("splurt"); | |
try{ | |
console.log(arguments.callee.caller.name); | |
// doesn't access the object. | |
} | |
catch(e){ | |
console.log("doesn't work "+ e); | |
} | |
} | |
var petrov = { | |
speak : function hiBuddy(){ | |
console.log("yap!"); | |
}, | |
poop : function(){ | |
dookie(this); | |
}, | |
poop2 : function pooping(){ | |
dookie2(); | |
} | |
}; | |
petrov.speak(); | |
petrov.poop(); | |
petrov.poop2(); |
No comments:
Post a Comment