Skip to content

Instantly share code, notes, and snippets.

@jindeveloper
Created September 1, 2020 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jindeveloper/c6fc6610c832c3ac5452991541464972 to your computer and use it in GitHub Desktop.
Save jindeveloper/c6fc6610c832c3ac5452991541464972 to your computer and use it in GitHub Desktop.
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