Travis build: 880
This commit is contained in:
@ -3340,7 +3340,7 @@ standardDeviation([10, 2, 38, 23, 38, 23, 21], true); // 12.29899614287479 (popu
|
||||
|
||||
### sum
|
||||
|
||||
Returns the sum of an of two or more numbers/arrays.
|
||||
Returns the sum of two or more numbers/arrays.
|
||||
|
||||
Use `Array.reduce()` to add each value to an accumulator, initialized with a value of `0`.
|
||||
|
||||
|
||||
@ -732,7 +732,7 @@ solveRPN('2 3 ^'); //8
|
||||
};
|
||||
</code></pre><pre><code class="language-js">standardDeviation([10, 2, 38, 23, 38, 23, 21]); // 13.284434142114991 (sample)
|
||||
standardDeviation([10, 2, 38, 23, 38, 23, 21], true); // 12.29899614287479 (population)
|
||||
</code></pre></div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="sum">sum</h3></div><div class="section double-padded"><p>Returns the sum of an of two or more numbers/arrays.</p><p>Use <code>Array.reduce()</code> to add each value to an accumulator, initialized with a value of <code>0</code>.</p><pre><code class="language-js">const sum = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0);
|
||||
</code></pre></div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="sum">sum</h3></div><div class="section double-padded"><p>Returns the sum of two or more numbers/arrays.</p><p>Use <code>Array.reduce()</code> to add each value to an accumulator, initialized with a value of <code>0</code>.</p><pre><code class="language-js">const sum = (...arr) => [].concat(...arr).reduce((acc, val) => acc + val, 0);
|
||||
</code></pre><pre><code class="language-js">sum([1, 2, 3, 4]); // 10
|
||||
</code></pre></div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="sumpower">sumPower</h3></div><div class="section double-padded"><p>Returns the sum of the powers of all the numbers from <code>start</code> to <code>end</code> (both inclusive).</p><p>Use <code>Array.fill()</code> to create an array of all the numbers in the target range, <code>Array.map()</code> and the exponent operator (<code>**</code>) to raise them to <code>power</code> and <code>Array.reduce()</code> to add them together. Omit the second argument, <code>power</code>, to use a default power of <code>2</code>. Omit the third argument, <code>start</code>, to use a default starting value of <code>1</code>.</p><pre><code class="language-js">const sumPower = (end, power = 2, start = 1) =>
|
||||
Array(end + 1 - start)
|
||||
|
||||
Reference in New Issue
Block a user