js-t数据类型定义错误


  <script>
       
        let l1=10;
        document.write(typeof(l1)+"num"+"<br>");
        let l2="hello js";
       document.write(typeof(l2)+"string"+"<br>");
        let l3;
        document.write(typeof(l3)+"undefine"+"<br>");
       
        let l5=true;
        document.write(typeof(l5)+"bool"+"<br>");
        let l6=null;
        document.write(typeof(l6)+"null"+"<br>");
       let l4 = 100 ;
       document.write(typeof(l4)+"bigint"+"<br>");
         

    </script>

输出结果为
numbernum
stringstring
undefinedundefine
booleanbool
objectnull
numberbigint

程序改为
let l4 = 100n ;

    <script>
       
        let l1=10;
        document.write(typeof(l1)+"num"+"<br>");
        let l2="hello js";
       document.write(typeof(l2)+"string"+"<br>");
        let l3;
        document.write(typeof(l3)+"undefine"+"<br>");
       
        let l5=true;
        document.write(typeof(l5)+"bool"+"<br>");
        let l6=null;
        document.write(typeof(l6)+"null"+"<br>");
       var l4 = 100n ;
       document.write(typeof(l4)+"bigint"+"<br>");
        
        

    </script>


输出结果为:
SCRIPT1004: 缺少 ';'

1问题出在哪里
2只加个n 没有改分号,没有任何输出结果,解释性语言不应该 及时后面有错误 也应该执行前面的么?

题主用的IE浏览器吧,不支持bigint出错了,用chrome或者Firefox测试正常

100n 是语法错误, 有语法错误整个代码都不会执行。
只有语法正确,运行时出错误。才是正常执行前面代码,到有错误的地方停止执行

如有帮助,望采纳!谢谢!