Amal works for MNC. He wants to calculate how much he saves in a month after all expenses are incurred. Amal considers any money that hasn't been spent to be savings. An array of four elements represents Amal's expenses in a single month. Calculate how much Amal has saved after incurring all these expenses.
Read the information below and output the expected result:
- Monthly salary is
25000. - Calculate the remaining salary after expenses by using the
reduce()method. - The result should be a single value.
- Use
console.loginside the function to output the result.