Created
September 1, 2020 05:26
-
-
Save jindeveloper/c6fc6610c832c3ac5452991541464972 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TOTAL_WORKING_DAYS = 261; | |
const getDailyRate = salary => Math.floor(((salary * 12) / (TOTAL_WORKING_DAYS))); | |
const dailyRate = employee => Object.assign({}, { employee: employee.employee, dailyRate: getDailyRate(employee.salary) }); | |
//Returns a new set of empoloyees with dailyRate and name | |
const newEmployees = employees.map(dailyRate); | |
//new data | |
console.log(newEmployees); | |
//old data | |
console.log(employees); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment