Skip to content

Commit 34d0187

Browse files
author
Jonathan
authored
Merge pull request freeCodeCamp#9230 from sahilkhurana19/fix/arraychallenge-renaming
Modified the challenge description for better understanding
2 parents 33d565e + 95a4113 commit 34d0187

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: seed/challenges/01-front-end-development-certification/object-oriented-and-functional-programming.json

+1
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@
350350
"description": [
351351
"The array method <code>reduce</code> is used to iterate through an array and condense it into one value.",
352352
"To use <code>reduce</code> you pass in a callback whose arguments are an accumulator (in this case, <code>previousVal</code>) and the current value (<code>currentVal</code>).",
353+
"The accumulator is like a total that <code>reduce</code> keeps track of after each operation. The current value is just the next element in the array you're iterating through.",
353354
"<code>reduce</code> has an optional second argument which can be used to set the initial value of the accumulator. If no initial value is specified it will be the first array element and <code>currentVal</code> will start with the second array element.",
354355
"Here is an example of <code>reduce</code> being used to subtract all the values of an array:",
355356
"<blockquote>var singleVal = array.reduce(function(previousVal, currentVal) {<br>&nbsp;&nbsp;return previousVal - currentVal;<br>}, 0);</blockquote>",

0 commit comments

Comments
 (0)