Javascript数据类型共有六种

Javascript数据类型共有六种

/*
var box;
alert(typeof box); // box是Undefined类型,值是undefined,类型返回的字符串是undefined

var box = true;
alert(typeof box); // box是Boolean类型,值是true,类型返回的字符串是boolean

var box = 'a';
alert(typeof box); // box是String类型,值是'a',类型返回的字符串是string

var box = 123;
alert(typeof box); // box是Number类型,值是123,类型返回的字符串是number

var box = {};
alert( box); // box是Object类型,值是[object Object],类型返回的字符串是object

var box = null;
alert( box); // box是Null类型,值是null,类型返回的字符串是object

var box = new Object();
alert( box); // box是Object类型,值是[object Object],类型返回的字符串是object

共有以上六种数据类型;function不是数据类型;

function box(){
}
alert(typeof box);// box是Function函数,值是function box(){},类型返回的字符串是function

typeof可以直接写入自变量;
alert(typeof nulla); // 这个返回undefined,但是nulla 是 is not defined

*/


alert(typeof nulla);
原文地址:https://www.cnblogs.com/stono/p/5568418.html