Created
September 1, 2020 05:27
-
-
Save jindeveloper/490fb03cb7d649832348ecf410a14fbe 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; | |
//Horrible in my opinion, worst someone will say it is ugly. | |
const dailyRate = (item, index, array) => array[index].dailyRate = Math.floor(((item.salary * 12) / (TOTAL_WORKING_DAYS))); | |
//undefined as forEach doesn't return any results. | |
let dailyRateEmployeeResults = employees.forEach(dailyRate); | |
console.log(dailyRateEmployeeResults);//undefined | |
console.log(employees); //With side effects. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment