I want to round up a number to the nearest thousand, at the moment I'm using this:
Math.ceil(value/1000)*1000;
But this goes always up, if I type 1001 it will go to 2000, I want to go up or down depeding on the number, for example 1001 goes to 1000 or 1400 goes to 1000 but 1500 goes to 2000
EDIT:
if(value<1000){
value = 1000;
}else{
value = Math.round(value/1000)*1000;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…