typeof与instanceof的区别
1.typeof 是一个操作符,主要的目的是检测一个变量是不是基本数据类型的变量,同时也可以说是确定一个变量是字符串,数值,布尔值,还是undefined
2.typeof 示例代码
var a="zhangqian";
var b=true;
var c=10;
var d;
var e=null;
var f=new Object();
alert(typeof a); //string
alert(typeof b); //number
alert(typeof c); //boolean
alert(typeof d); //undefined
alert(typeof e); //object
alert(typeof f); //object