摘要:
function getDataType(obj) { let type = typeof obj // 先判断是否为基础数据类型,直接返回 if (type !== 'object') return type; // 对于typeof返回结果是'object'的,在进行如下的判断,正则返回结果 r 阅读全文
摘要:
// 计算数组中最大值 const arr = [1,2,3,4,5,6,7,8,9] let max = arr.reduce((max, age) => { return max > age ? max : age },0) <!--console.log(max)--> // 数组转哈希对象 阅读全文
摘要:
let y = new Date().getFullYear() + '-' let m = (new Date().getMonth() + 1 < 10) ? '0' + (new Date().getMonth() + 1) + '-' : (new Date().getMonth() + 1 阅读全文