Created
December 22, 2021 16:07
-
-
Save jagdishlove/3cfebded6acb7b3b8c0d386961038427 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
//Milestones having nested array object which was very confusing for me making this gist so that people get confortable with map and reduce function. | |
const totalMeetings = milestones.map(o => o.exercises.map(i => i.exercise)).reduce((acc, m) => acc.concat(m)).sort() | |
const totalCcExercises = totalMeetings?.filter(x => x === 478 || x === 480 || x === 170 || x === 213).length //this will count total repeated number of 478, 480, 170 and 213 | |
const totalHcExercises = totalMeetings?.filter(x => x === 477 || x === 481 || x === 171 || x === 214).length | |
const totalFaExercises = totalMeetings?.filter(x => x === 479 || x === 211).length | |
const totalCssExercises = totalMeetings?.filter(x => x === 482 || x === 218).length | |
const fafsaCssExercises = totalMeetings?.filter(x => x === 483 || x === 218).length |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment