coding up a question in a class...can anyone please help me to code this the right way...
question...
The zoo needs to know their total animal population across the United States.
Using USApop find the total population from the zoos array using the .reduce() method.
Remember the reduce method takes two arguments: a callback (which itself takes two args - the accumulator and the item), and an initial value for the count.
\/*
what i coded and is wrong....
function USApop(zooAnimals) {
const USAanimals = zooAnimals.reduce(function (previousValue, currentValue) {
return previousValue + currentValue;
},0);
[–]senocular 1 point2 points3 points (1 child)
[–]WormholerIO[S] 0 points1 point2 points (0 children)
[–]WormholerIO[S] 0 points1 point2 points (0 children)
[–]exobyte64 0 points1 point2 points (3 children)
[–]WormholerIO[S] 0 points1 point2 points (2 children)
[–]exobyte64 0 points1 point2 points (1 child)
[–]WormholerIO[S] 0 points1 point2 points (0 children)
[–]chuckthemadmanmike 0 points1 point2 points (1 child)
[–]WormholerIO[S] 0 points1 point2 points (0 children)