I am trying to use two arrays to calculate max value and average values to create key/value object.
Here are the two arrays
const products = ["car", "car", "motorcycle", "motorcycle"] // key
const prices =[2000, 1500, 800, 900] // value
desire outcome -
{"car" : {max: 2000, average: 1750},
"motorcycle":{max: 900, average: 850} }
It will be great if ES6 iterators like reduce/map and etc can be used for solution.
Thank you for help!