区分数据类型
1.分两类 原始值,引用值,null单独处理
2.区分引用值
function typeFn(target){ if(target===null) return null; let template={ '[object Array]':'array', '[object Object]':'object', '[object Number]':'number-object', '[object Boolean]':'boolean-object', '[object String]':'string-object', } if(typeof(target)=='object'){ return template[Object.prototype.toString.call(target)]; }else{ return typeof(target); } } let arr=new String('12') console.log(typeFn(arr));//string-object