js 获取数据类型
function getType(obj){ return (obj === null && 'Null') || (obj === undefined && 'Undefined') || Object.prototype.toString.call(obj).slice(8,-1); } getType(null); "Null" getType(undefined); "Undefined" getType(false); "Boolean" getType(NaN); "Number" getType([]); "Array" getType({}); "Object" getType(/x/); "RegExp" getType(new Date); "Date" getType(function(){}); "Function" getType(Function); "Function" getType(''); "String"