js判断数据类型,检测方式有哪些?
1. typeoftypeof常用于判断基本数据类型,因为对象、数组和Null都返回的Objectconsole.log(typeof '温情'); // stringconsole.log(typeof 111); // numberconsole.log(typeof true); // booleanconsole.log(typeof undefined); // undefinedconsole.log(typeof function () { }); // function