Travis build: 891
This commit is contained in:
@ -147,8 +147,7 @@ For teams, each rating can adjusted based on own team's average rating vs.
|
||||
average rating of opposing team, with the score being added to their
|
||||
own individual rating by supplying it as the third argument.
|
||||
*/</span>
|
||||
</pre></div><div class="card code-card"><div class="corner beginner"></div><div class="section card-content"><h4 id="factorial">factorial</h4><p>Calculates the factorial of a number.</p><p>Use recursion. If <code>n</code> is less than or equal to <code>1</code>, return <code>1</code>. Otherwise, return the product of <code>n</code> and the factorial of <code>n - 1</code>. Throws an exception if <code>n</code> is a negative number.</p></div><div class="copy-button-container"><button class="copy-button" aria-label="Copy to clipboard"></button></div><pre class="section card-code language-js">
|
||||
<span class="token keyword">const</span> <span class="token function-variable function">factorial</span> <span class="token operator">=</span> n <span class="token operator">=></span>
|
||||
</pre></div><div class="card code-card"><div class="corner beginner"></div><div class="section card-content"><h4 id="factorial">factorial</h4><p>Calculates the factorial of a number.</p><p>Use recursion. If <code>n</code> is less than or equal to <code>1</code>, return <code>1</code>. Otherwise, return the product of <code>n</code> and the factorial of <code>n - 1</code>. Throws an exception if <code>n</code> is a negative number.</p></div><div class="copy-button-container"><button class="copy-button" aria-label="Copy to clipboard"></button></div><pre class="section card-code language-js"><span class="token keyword">const</span> <span class="token function-variable function">factorial</span> <span class="token operator">=</span> n <span class="token operator">=></span>
|
||||
n <span class="token operator"><</span> <span class="token number">0</span>
|
||||
<span class="token operator">?</span> <span class="token punctuation">(()</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
|
||||
<span class="token keyword">throw new</span> <span class="token class-name">TypeError</span><span class="token punctuation">(</span><span class="token string">'Negative numbers are not allowed!'</span><span class="token punctuation">);
|
||||
|
||||
Reference in New Issue
Block a user