how can I divide number (money) to x number equally the number could be with one or two decimal or without it
such as 1000 or 100.2 or
1000
100.2
Try it function myFunction(number,divide) { var money = number / divide; money = Math.ceil(money * 100) / 100; alert(money); //1285.34 }
http://jsbin.com/ucuFuLa