typeof运算符

35 阅读1分钟

基本用法:typeof是引擎提供的内置方法,执行结果返回字符串,且均为小写,包括number,string,boolean,undefined,object,function,symbol

举例说明: typeof ""; //string

typeof 1; //number

typeof false; //boolean

typeof undefined; //undefined

**typeof function(){}; //function **

typeof {}; //object

typeof Symbol(); //symbol

typeof null; //object

typeof []; //object

typeof new Date(); //object

typeof new RegExp(); //object