Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Example of method chaining with map, reduce and filter.
- * @param {*} minExp - minimum experience of developer
- * @param {*} bonus - bonus amount to be added
- */
- const calTotalSalary = (minExp, bonus) => developers
- .filter(developer => developer.expInYears > minExp)
- .map(developer => developer.salary + bonus)
- .reduce((acc, salary) => acc + salary, 0)
- const total = calTotalSalary(3, 5000);
- console.log(total); // 375000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement