1.js 错误
var objClass = { foo:1, bar:2 }; function printf() { var aaa:objClass; aaa.foo = 2; console.log(objClass.bar); } function throwIt() { throw new Error(""); } function catchIt() { console.log(catchIt.name); try { throwIt(); }catch (e) { console.log(e.stack); } }
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>DataType</title> <script type="text/javascript" src="scripts/dataType.js"></script> </head> <body> <p onclick="catchIt();return false;">Test</p> </body> </html>
明明定义了方法,却报错误,多次尝试后,分析为js里面有错误,导致编译其实是不过的,所以加载js是有问题的。
catchIt Error at throwIt (http://localhost:63343/H51/scripts/dataType.js:7:11) at catchIt (http://localhost:63343/H51/scripts/dataType.js:13:9) at HTMLParagraphElement.onclick (http://localhost:63343/H51/DataType.html:9:38)
这个就是callstack。