-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem64.js
More file actions
24 lines (14 loc) · 675 Bytes
/
problem64.js
File metadata and controls
24 lines (14 loc) · 675 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* =====================================================
------ An Ideal Example of Callback Function --------
===================================================== */
const totalMoney = (depositOne, depositTwo, interest) => {
const totalDepositAmount = depositOne + depositTwo ;
const profit = interest(totalDepositAmount);
return totalDepositAmount + parseFloat(profit) ;
}
const totalInterest = totalDeposit => {
const interestRate = 7 / 100 ; // Suppose Interest Rate is 7 %
return (totalDeposit*interestRate).toFixed(2);
};
const grandTotal = totalMoney(900, 1100, totalInterest);
console.log(grandTotal);