[removed] is given function empty?

后端 未结 6 1809
日久生厌
日久生厌 2020-12-03 07:50

Let\'s have a function call

function doSomethingAndInvokeCallback(callback){
    // do something
    callback();
}

I can check if given arg

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 08:16

    In some implementation you can just do a toString() on the function and get it's content. Though it contains comments etcetera.

    var foo = function(){ /* Comment */ };
    alert(foo.toString());
    

提交回复
热议问题