標籤:show click spl color printf col text class 分享
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); }}
<!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>
View Code
明明定義了方法,卻報錯誤,多次嘗試後,分析為js裡面有錯誤,導致編譯其實是不過的,所以載入js是有問題的。
catchItError 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。
JavaScript 教程 之基礎教程