javaScript-1 数据类型

javaScript 数据类型
<!DOCTYPE html>
<html>
  <head>
    <title>javaScript 数据类型</title>
  </head>
  <body>
    <p id = "typeof"></p>
    <script>
     document.getElementById("typeof").innerHTML = 
            "typeof \"test string\"->" +typeof "test string" + "<br>" +
            "typeof 1234567->"+typeof 1234567 + "<br>" +
            "typeof NaN->"+typeof NaN + "<br>" +
            "typeof true->"+typeof true + "<br>" +
            "typeof [1,2,3,4]->"+typeof [1,2,3,4] + "<br>" +
            "typeof {name:'jack ma', sex:'女',age:50}->"+typeof {name:'jack ma', sex:'',age:50} + "<br>" +
            "typeof new Date()->"+typeof new Date() + "<br>" +
            "typeof function () {}->"+typeof function () {} + "<br>" +
            "typeof abc->"+typeof abc + "<br>" +
            "typeof null->"+typeof null;

      var Animal = function() {
        type:"cat";
        name:"KT"
      };
      var animal = new Animal();
        console.log((animal instanceof Animal))
    </script>
  </body>

</html>

 

posted @ 2022-09-25 16:54  怪圣卡杰  阅读(9)  评论(0编辑  收藏  举报