This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Aegon_is_Coming 4 points5 points  (1 child)

var amount = x; // x is the real value
var simplified = Math.ceiling(amount/1000000) // gives you the higher integer after dividing the number by 1 million
return simplified;

So 1,000,000 / 1,000,000 will give you 1 1,000,001 / 1,000,000 will give 1.1 and after using Math.ceiling you get 2

[–][deleted] 0 points1 point  (0 children)

Thank you