复杂还是简单? function multiply(a, b) { var mul=[1,1] var ab=[a,b].map((num,index)=>(''+num).replace(/\.(\d*)/,(_,$)=>{ mul[index]=Math.pow(10,$.length) return $ })) return ab.reduce((a,b)=>a*b)/mul.reduce((a,b)=>a*b) }
复杂还是简单? function multiply(a, b) { var mul=[1,1] var ab=[a,b].map((num,index)=>(''+num).replace(/\.(\d*)/,(_,$)=>{ mul[index]=Math.pow(10,$.length) return $ })) return ab.reduce((a,b)=>a*b)/mul.reduce((a,b)=>a*b) }