Calling toString on a javascript function returns source code

前端 未结 6 1275
梦如初夏
梦如初夏 2020-12-14 06:06

I just found out that when you call toString() on a javascript function, as in myFunction.toString(), the source code of that function is returned.

If y

6条回答
  •  天命终不由人
    2020-12-14 06:55

    function.ToString - Returns a string representing the source code of the function. For Function objects, the built-in toString method decompiles the function back into the JavaScript source that defines the function.

    Read this on mozilla.

提交回复
热议问题