Functions have a toString() method. (Yes functions have methods!)
var fn = function() { alert('hello') }; fn.toString()
So you can warn him:
alert(fn.toString());
You can register it in js console:
console.log(fn.toString());
Or even write it to a page.
document.getElementById('someID').innerHTML = fn.toString();
However, this will not work for every function in the universe.
[].push.toString() "function push() { [native code] }"
Some functions are not implemented using javascript, but in compiled browser code or JS engine. For these features provided by the environment, you will get this less useful output.
source share