Getting Chrome's console.log to display the line that called a function

后端 未结 2 1615
悲&欢浪女
悲&欢浪女 2020-12-21 23:10

Is there any way in the Chrome Console tab to display the address that called a function?

I have a function that\'s being called but I don\'t know where from. I know

相关标签:
2条回答
  • 2020-12-21 23:41

    The answer to this question might be what you are looking for.

    It uses the trick of throwing an exception, then accessing the LineNumber property and printing it.

    0 讨论(0)
  • 2020-12-21 23:42

    I don't think you can do that with console.log(). Try with console.error() if you're fine with red output.

    0 讨论(0)
提交回复
热议问题