zoukankan      html  css  js  c++  java
  • js的console总结

    1.

    <!DOCTYPE html>
    <html>
    <head>
       <title>format</title>
       <meta charset="gbk">
    </head>
    <body>
        我爱GH
    </body>
    <script type="text/javascript">
        console.log("log");
        console.warn("warning");
        console.error("error");
    </script>
    </html>

    2.

    <!DOCTYPE html>
    <html>
    <head>
       <title>format</title>
    </head>
    <body>
        hello World
    </body>
     <script type="text/javascript">
         console.log("身高:%dcm,体重:%fkg",188,44.4);
     </script>
     </html>

    3.

    <!DOCTYPE html>
    <html>
    <head>
       <title>分组的使用</title>
    </head>
    <body>
        hello World
    </body>
     <script type="text/javascript">
        console.group("1");
        console.groupEnd();
      console.group("2");
        console.log("2.1:我很丑");
        console.log("2.2:但是我很温柔");
      console.groupEnd();
     </script>
     </html>

    4.

    <!DOCTYPE html>
    <html>
    <head>
       <title>类的输出</title>
    </head>
    <body>
        hello World
    </body>
    <script type="text/javascript">
        var info = {
            age:20,
            interesting:"mobile programing"
        };
        console.dir(info);
    </script>
    </html>

    5.

    <!DOCTYPE html>
    <html>
    <head>
       <title>html元素的打印</title>
    </head>
    <body>
    <div id="bice">
        <p>我爱程序设计</p>
    </div>
    </body>
    <script type="text/javascript">
           var info = document.getElementById('bice');
           console.dirxml(info);
    </script>
    </html>

    6.

     <!DOCTYPE html>
    <html>
    <head>
       <title>assert判断真假</title>
    </head>
    <body>
    <div id="bice">
        <p>我爱程序设计</p>
    </div>
    </body>
    <script type="text/javascript">
        console.assert( 1 ,"结果为假");
        var code = 1024;
        console.assert(year == 2048 ,"code不等");
    </script>
    </html>

    7.

     <!DOCTYPE html>
    <html>
    <head>
    <title>追踪函数</title>
    </head>
    <body>
    <div id="bice">
        <p>我爱程序设计</p>
    </div>
    </body>
    <script type="text/javascript">
      function test(a,b){
            console.trace();
      }
      test(1,1);
    </script>
    </html>

    8.

     <!DOCTYPE html>
    <html>
    <head>
       <title>计时</title>
    </head>
    <body>
    <div id="bice">
        <p>我爱程序设计</p>
    </div>
    </body>
    <script type="text/javascript">
        console.time("计时开始");
      for(var i=0;i<1000;i++){
        for(var j=0;j<1000;j++){}
      }
      console.timeEnd("计时结束");
    </script>
    </html>

    9.

     <!DOCTYPE html>
    <html>
    <head>
       <title>性能分析</title>
    </head>
    <body>
    <div id="bice">
        <p>我爱程序设计</p>
    </div>
    </body>
    <script type="text/javascript">
        function Test(){
            alert("性能测试");
           for(var i=0;i<1000;i++){
              for (var i = 0; i < 1000; i++) {
                  for (var i = 0; i < 1000; i++) {}
              }
            }
      }
       console.profile('性能分析器');
        Test();
           console.profileEnd();
    </script>
    </html>
  • 相关阅读:
    Centos PHP+Apache执行exec()等Linux脚本权限设置的详细步骤
    新版本的bettercap不好用, 如何安装和编译旧版本的bettercap
    iqiyi__youku__cookie_设置
    window系统命令行设置proxy----Setting a proxy for Windows using the command-line
    修改Electron的libcc(libchromiumcontent)源码,重新编译electron, 设置event.isTrusted为true
    apache配置伪静态Rewrite
    sql注入工具:sqlmap命令
    Reject insecure SameSite=None cookies
    Spring Session Session Max Inactive Interval
    nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory
  • 原文地址:https://www.cnblogs.com/qvbrgw/p/4525241.html
Copyright © 2011-2022 走看看