js reduce

 var numbers = [65, 44, 12, 4];
 numbers.reduce((a,b) => {
    return a + b
 })

判断数据类型:

return Object.prototype.toString.call(ps).match(/\s+(\w+)/)[1]

你可能感兴趣的:(js reduce)