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
function divide(numerator, divisor) {
var results = [];
var dividend = (Math.floor(numerator/divisor*100)/100).toFixed(2); // dividend with 2 decimal places
for (var i = 0; i < divisor-1; i++) {
results.push(dividend); // Put n-1 copies of dividend in results
}
results.push(numerator - (divisor-1)*dividend); // Add remainder to results
return results;
}