Array.reduce(function(accumulator, currentValue){
// currentValue represents each element in the array passed to this function one by one
}, default_value_of_accumulator);
Picture the reduce function iterates through the array elements one by one, passing each element into the callback function as currentValue along with an accumulator, by default starting as an empty {}. With each iteration of the callback function for each array element, the accumulator can be modified as desired (e.g., adding new properties to an object). Consider your scenario and the process of each callback function execution as demonstrated below.
1st run:
(p, c) => {
/*
prior -
p= {} // empty default value provided to the reduce function
c= [1,'a'] // first array element
*/
p[c[0]] = c[1];
/*
after -
p = { 1: 'a' }
*/
return p;
}, {})
2nd run:
(p, c) => {
/*
prior -
p= { 1: 'a'} // previous result of the accumulator
c= [2,'b'] // second array element
*/
p[c[0]] = c[1];
/*
after -
p = { 1: 'a', 2: 'b' }
*/
return p;
}, {})
3rd run:
(p, c) => {
/*
prior -
p= { 1: 'a', 2: 'b' } // previous result of the accumulator
c= [3,'c'] // last array element
*/
p[c[0]] = c[1];
/*
result after the final iteration of reduce -
p = { 1: 'a', 2: 'b', 3: 'c' }
*/
return p;
}, {})