I have an array of objects:
let fileArray = [
{ filename: 'File1.txt', bytes: 12345, created: 1548360783511.728 },
{ filename: 'File2.txt', bytes: 34567, created: 1548361491237.182 },
{ filename: 'File3.txt', bytes: 23456, created: 1548361875763.893 },
{ filename: 'File4.txt', bytes: 56789, created: 1548360658932.682 }
];
The two things I am wanting to do with this array is to find the total bytes of all files in this array sum of numbers and the File created first (smallest) Obtain smallest value from array in Javascript?.
I was looking at array.reduce(), but that only appears to work on a flat array. Can it work on specific keys of an array of objects or will I have to create a new temp array all values for that key in the current array and run array.reduce() on those values?