js 判断数据类型
function getType(variable)
return typeof variable === 'object' ? Object.prototype.toString.call(variable).replace('[object ', '').replace(']', '').toLowerCase() : typeof variable; }
const numArr = [1,2,3];
getType(numArr); //array
判断数据类型是否为Array
[1,2,3,4].constructor // 返回函数 Array() { [native code] }
判断数据类型是否为Array
[1,2,3,4].constructor.toString().indexOf("Array") > -1;

浙公网安备 33010602011771号