Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function savings(input) {
- let incomePerMonth = parseFloat(input.shift());
- let months = parseInt(input.shift());
- let personalExpenses = parseFloat(input.shift());
- let moneyLeft = incomePerMonth - personalExpenses - (incomePerMonth * 0.3);
- let maxPercent = ((moneyLeft / incomePerMonth) * 100).toFixed(2);
- let sum = (months * moneyLeft).toFixed(2);
- console.log(`She can save ${maxPercent}%`);
- console.log(sum);
- }
- //savings([ '1500', '3', '800' ]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement