Given the exercise data:
const exercises = {
"Forward Lunge": {
musclesTargeted: ["quadriceps", "gluteus", "adductor magnus"],
difficultyLevel: 5
},
"Reverse Lunge": {
musclesTargeted: ["quadriceps", "gluteus", "adductor magnus"],
difficultyLevel: 5
},
"Pushup": {
musclesTargeted: ["pectorals", "triceps", "anterior deltoids"],
difficultyLevel: 7
},
"Squat": {
musclesTargeted: ["quadriceps", "gluteus ", "hamstrings"],
difficultyLevel: 7
},
"Burpee": {
musclesTargeted: ["hamstrings", "quadriceps", "calves", "triceps", "pectorals", "quadriceps"],
difficultyLevel: 10
},
"Plank": {
musclesTargeted: ["abdominal", "erector spinae"],
difficultyLevel: 8
}
};
Write a function to output all of the exercise names for exercises that have a difficulty level of 7. The output should look like:
["Pushup", "Squat"];Modify your function to rearrange the data and output exercises grouped by their difficulty level. The output should look something like:
{
5: ["Forward Lunge", "Reverse Lunge"],
7: ["Pushup", "Squat"],
8: ["Plank"],
10: ["Burpee"]
};Modify your function to return a list of all of the exercises with only their last two musclesTargeted:
{
Forward Lunge: ['gluteus', 'adductor magnus'],
Reverse Lunge: ['gluteus', 'adductor magnus'],
Pushup: ['triceps', 'anterior deltoids'],
Squat: ['gluteus ', 'hamstrings'],
Burpee: ['pectorals', 'quadriceps'],
Plank: ['abdominal', 'erector spinae']
};