【前端学习】---JS判断数据类型的方式有哪些(八)

一、JS中判断数据类型的场景

二、JS中有哪些数据类型

三、JS判断数据类型的方式有哪些


bash
const arr=[];
const object={};
const number=1;
const string='string';
//typeof
const type=typeof arr;
console.log(`type`,type);//type object
const type1=Object.prototype.toString.call(object);
console.log(type1);//[object Object]
const type11=typeof number;
console.log(type11);//number