向上取数
2020-08-04 本文已影响0人
爱看小说的叶子
取两个数组中的最大值,然后将向上取整,如14000,变成20000.
getYMax(ay1, ay2){
let ay = ay1.concat(ay2)
let max = Math.floor(Math.max(...ay))
// let max = Math.floor(ay[ay.length-1])
let value = 1
let length = max.toString().length -1
for(let i = 0; i < length; i++){
value = value * 10
}
let showMax = Math.ceil(max/value) * value
return showMax
},