标签:ret object boolean bool cal span tar call return
function type(target){ var template = { ‘[object Array]‘:‘array‘, ‘[object Object]‘:‘object‘, ‘[object Number]‘:‘number - object‘, ‘[object Boolean]‘:‘boolean - object‘, ‘[object String]‘:‘string - object‘, } if(target === null){ return ‘null‘; } if(typeof(target)==‘object‘){ var str = Object.prototype.toString.call(target); return template[str]; }else{ return typeof(target); } }
标签:ret object boolean bool cal span tar call return
原文地址:https://www.cnblogs.com/yqyf/p/12503851.html