001.JavaScript变量

001.JavaScript变量

 

 

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>变量</title>
    </head>
    <body>
        <script>
            alert("变量练习");
            /**
             *   document.write(num+"<br>");输出到页面上
             */
            //定义number类型
            var a = 123;
            document.write(a + "<br>");
            var b = 1.2;
            document.write(b + "<br>");
            var c = NaN;
            document.write(c);
            
            //定义string类型
            var str = "abc";
            var str2 = 'edf';
            document.write(str + "<br>");
            document.write(str2 + "<br>");

            //定义boolean
            var flag = true;
            document.write(flag + "<br>");

            // 定义null,undefined
            var obj = null;
            var obj2 = undefined;
            var obj3;
            document.write(obj + "<br>");
            document.write(obj2 + "<br>");
            document.write(obj3 + "<br>");
            
            
        </script>
    </body>
</html>

 

上一篇:国标GB28181视频服务EasyGBS的架构设计:一面安防、一面互联网


下一篇:洛谷 P7453 [THUSCH2017] 大魔法师