function multiply(...args) { let len = Math.max(args[0].toString().includes(".") ? args[0].toString().split(".")[1].length : 0, args[1].toString().includes(".") ? args[1].toString().split(".")[1].length : 0) let divisor = Math.pow(10,len) * Math.pow(10,len) let count = args.reduce((count,num)=> count *= num*Math.pow(10,len) ,1) return count /= divisor }
将小数变为整数,自然不用考虑精度问题