1、中级
const fn = (num) => num % 5 === 0 ? num : num - num % 5;
2、高级
const fn1 = (num) =>parseInt(num / 5) * 5;
3、骨灰级
const fn = (num) =>~~(num / 5) * 5;
4、垃圾
const MAXarr = String(parseInt(Number(data.numMAX) - 5)).split('');
if (MAXarr[MAXarr.length - 1] > '0' && MAXarr[MAXarr.length - 1] < '5') {
MAXarr[MAXarr.length - 1] = '0'
}else if(MAXarr[MAXarr.length - 1] > '5' && MAXarr[MAXarr.length - 1] < '9'){
MAXarr[MAXarr.length - 1] = '5'
}
网友评论