0

Get the highest value and lowest value from a mapped array in javascript

I have mapped my integer array to produce this kind of array [ { key: 0, value: 10 }, { key: 1, value: 9 }, { key: 2, value: 8 }, { key: 3, value: 6 }, { key: 4, value: 5 }, { key: 5, value: 3 } ] i used this code to do the mapping let arrArray=new Array(10,9,8,6,5,3); var newArr = arrArray.map(function(val, index){ return {key:index, value:val}; }); Is there any function i can use to get the max and min integers from the mapped array, Thank you

28th Feb 2021, 4:30 PM
Timothy Njiru
Timothy Njiru - avatar
1 Resposta