javascript基础--变量类型
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>变量类型1</title> <script> var a = 12; //alert(typeof a);//number不区分整数小数 a = 'abc'; //alert(typeof a); //string a = true; //alert(typeof a); //boolean // window.onload = function() { // a = document.getElementById('div1'); // alert(typeof a); //object //------------- abject-------------------------- // 不是基本的东西组成的(即除了number string boolean undefined),都是对象object // 范例: 对象.html // } a = function() { alert('abc'); } //alert(typeof a); //function var b; alert(typeof b); //undefined; //-------------- undefined----------------------- //1你真的没有定义 2定义了但是没有给值 </script> </head> <body> <div id="div1"> </div> </body> </html>