我在我的应用程序中通过错误消息使用了一个函数。
我这样做是为了识别错误行号和文件位置。
很好,它运行良好,但我对这些行号感到困惑,因为每个行号都有 2 个值。
请查看其中一条相同的错误消息:
Error
at Object.Core.initAlert (http://localhost/demo/core.js:205:22)
at http://localhost/demo/app.js:26:10
at _setImmediate (http://localhost/demo/async.js:182:20)
at http://localhost/demo/async.js:234:13
at http://localhost/demo/async.js:113:13
at _arrayEach (http://localhost/demo/async.js:85:13)
at _forEachOf (http://localhost/demo/async.js:112:9)
at _each (http://localhost/demo/async.js:77:13)
at Object.async.forEachOf.async.eachOf (http://localhost/demo/async.js:233:9)
at Object.async.forEach.async.each (http://localhost/demo/async.js:210:22)
你可以看到最后一行有两个行号,我在这里很困惑哪一个是函数语句的行号。第一个或第二个。
例如。在第一行:
at Object.Core.initAlert (http://localhost/demo/core.js:205:22)
有205和22
有没有人知道....
或者有没有其他方法可以跟踪 javascript 中的执行堆栈。
最佳答案
第一个数字是行号,第二个数字是列号。
关于javascript - 如何理解javascript错误调试信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31563093/