24js基礎,資料型別
阿新 • • 發佈:2022-04-10
</head>
<body>
<script>
var n1 = 100 //整數
, n2 = 98.4 //浮點
, n3 = "apple" //字串
, n4 = 'a' //字元
, n5 = true //布林
, n6 = ["ert","wsde"] //陣列
, n7 = { //物件
username : "qwsas"
,password : "123456"
}
, n8 = function () { //方法
}
, n9 = null //空值
, n10; //未賦值
document.writeln("n1;"+n1+",資料型別:"+typeof(n1)+"<br>");
document.writeln("n2;"+n2+",資料型別:"+typeof(n2)+"<br>");
document.writeln("n3;"+n3+",資料型別:"+typeof(n3)+"<br>");
document.writeln("n4;"+n4+",資料型別:"+typeof(n4)+"<br>");
document.writeln("n5;"+n5+",資料型別:"+typeof(n5)+"<br>");
document.writeln("n6;"+n6+",資料型別:"+typeof(n6)+"<br>");
document.writeln("n7;"+n7+",資料型別:"+typeof(n7)+"<br>");
document.writeln("n8;"+n8+",資料型別:"+typeof(n8)+"<br>");
document.writeln("n9;"+n9+",資料型別:"+typeof(n9)+"<br>");
document.writeln("n10;"+n10+",資料型別:"+typeof(n10)+"<br>");
</script>
</body>