zoukankan      html  css  js  c++  java
  • JavaScript 教程 之基础教程

    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是有问题的。

    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。

  • 相关阅读:
    vi
    head
    uniq
    sort
    所谓静态绑定
    债务
    不确
    tar
    VMWare虚拟系统上网设置 及 三种模式详解
    awk
  • 原文地址:https://www.cnblogs.com/deman/p/9606049.html
Copyright © 2011-2022 走看看