<script type="text/javascript"> var name; var name="吴彦祖"; var name1="陈冠希"; //不推荐 name2="柯震东"; var age=20; var sex=‘男‘; var isStudent=true; var pi=3.14; var addr; //变量赋值后,获取变量的数据类型 //输出到页面的body中 document.write("name:"+typeof name+"<br/>"); document.write("age:"+typeof age+"<br/>"); document.write("sex:"+typeof sex+"<br/>"); document.write("isStudent:"+typeof isStudent+"<br/>") document.write("pi"+typeof pi+"<br/>"); document.write("addr"+typeof addr);
时间: 2024-10-23 22:05:17