Calling toString on a javascript function returns source code

前端 未结 6 1271
梦如初夏
梦如初夏 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 07:04

    My use case - I have a node program that processes data and produces interactive reports as html/js/css files. To generate a js function, my node code calls myfunc.toString() and writes it to a file.

提交回复
热议问题