Console.log javascript [Function]

I am trying to register a function in javascript:

console.log(callback) >>[Function] 

I want to see what this function is. I can do it? Thank.

+64
javascript function console
Feb 27 '12 at 6:20
source share
1 answer

If this is a user-defined function, you can use:

 console.log(callback.toString()); 

Otherwise, you just get something like [native code] , since the built-in functions are not written in JavaScript.

Example:

 function x(){} // Prints "function x(){}" (function(callback){ console.log(callback.toString()); })(x); 
+87
Feb 27 '12 at 6:26
source share



All Articles