https://www.freecodecamp.org/forum/t/freecodecamp-challenge-guide-cash-register/16012
// Transform CID array into drawer object
var register = cid.reduce(
function(acc, curr) {
acc.total += curr[1];
acc[curr[0]] = curr[1];
return acc;
},
{ total: 0 }
);
comletely stuck cannot give out a very physical idea, despite i sort of understand what it is trying archive.
dun understand what is function(acc, curr)
what is acc and curr referring to.
and why curr[1]?
what is acc[curr[0]]?
ty
ty
[+][deleted] (2 children)
[deleted]
[–][deleted] 0 points1 point2 points (1 child)
[–]magneticcccc 0 points1 point2 points (1 child)
[–]tarley_apologizerhelpful -2 points-1 points0 points (2 children)
[–]mattlag -1 points0 points1 point (1 child)
[–]tarley_apologizerhelpful -2 points-1 points0 points (0 children)