fix fibonacci example typo

This commit is contained in:
bobby569
2017-12-29 22:41:43 -05:00
parent 6219892639
commit 833f742ffe
3 changed files with 6 additions and 7 deletions

View File

@ -436,7 +436,7 @@ collatz(5); // 16
(acc, val, i) => acc.concat(i > 1 ? acc[i - 1] + acc[i - 2] : i),
[]
);
</code></pre><pre><code class="language-js">fibonacci(6); // 720
</code></pre><pre><code class="language-js">fibonacci(6); // [0, 1, 1, 2, 3, 5]
</code></pre></div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="fibonaccicountuntilnum">fibonacciCountUntilNum</h3></div><div class="section double-padded"><p>Returns the number of fibonnacci numbers up to <code>num</code>(<code>0</code> and <code>num</code> inclusive).</p><p>Use a mathematical formula to calculate the number of fibonacci numbers until <code>num</code>.</p><pre><code class="language-js">const fibonacciCountUntilNum = num =&gt;
Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2));
</code></pre><pre><code class="language-js">fibonacciCountUntilNum(10); // 7
@ -842,4 +842,4 @@ console.log(sdbm('age')); // 808122783
</code></pre><pre><code class="language-js">toOrdinalSuffix('123'); // &quot;123rd&quot;
</code></pre></div></div><br/><div class="card fluid"><div class="section double-padded"><h3 id="validatenumber">validateNumber</h3></div><div class="section double-padded"><p>Returns <code>true</code> if the given value is a number, <code>false</code> otherwise.</p><p>Use <code>!isNaN</code> in combination with <code>parseFloat()</code> to check if the argument is a number. Use <code>isFinite()</code> to check if the number is finite. Use <code>Number()</code> to check if the coercion holds.</p><pre><code class="language-js">const validateNumber = n =&gt; !isNaN(parseFloat(n)) &amp;&amp; isFinite(n) &amp;&amp; Number(n) == n;
</code></pre><pre><code class="language-js">validateNumber('10'); // true
</code></pre></div></div><br/><footer><p style="display:inline-block"><strong>30 seconds of code</strong> is licensed under the <a href="https://github.com/Chalarangelo/30-seconds-of-code/blob/master/LICENSE">CC0-1.0</a> license.<br/>Icons made by <a href="https://www.flaticon.com/authors/smashicons">Smashicons</a> from <a href="https://www.flaticon.com/">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/">CC 3.0 BY</a>.<br/>Ribbon made by <a href="https://github.com/tholman/github-corners">Tim Holman</a> is licensed by <a href="https://opensource.org/licenses/MIT">The MIT License</a><br/>Built with the <a href="https://minicss.org">mini.css framework</a>.</p><a href="#top"><span style="display:inline-block;float:right;padding-right:2em">Back to top</span></a></footer></main></div><script src="prism.js"></script></body></html>
</code></pre></div></div><br/><footer><p style="display:inline-block"><strong>30 seconds of code</strong> is licensed under the <a href="https://github.com/Chalarangelo/30-seconds-of-code/blob/master/LICENSE">CC0-1.0</a> license.<br/>Icons made by <a href="https://www.flaticon.com/authors/smashicons">Smashicons</a> from <a href="https://www.flaticon.com/">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/">CC 3.0 BY</a>.<br/>Ribbon made by <a href="https://github.com/tholman/github-corners">Tim Holman</a> is licensed by <a href="https://opensource.org/licenses/MIT">The MIT License</a><br/>Built with the <a href="https://minicss.org">mini.css framework</a>.</p><a href="#top"><span style="display:inline-block;float:right;padding-right:2em">Back to top</span></a></footer></main></div><script src="prism.js"></script></body></html>