In JavaScript, let's say you have:
function doSomething(callback) {
if (callback instanceof Function) callback();
}
doSomething(function() {
alert('hello world');
});
Is there a way to check what is inside 'callback' (like, the fact that alert()
is called) from doSomething()
? Something like:
function doSomething(callback) {
alert(callback.innards().indexOf('alert('));
}
I'm just curious