Add JSdocs for fibonacci.

This commit is contained in:
Oleksii Trekhleb 2018-06-02 09:32:50 +03:00
parent d267d72524
commit 88bd8d7044
2 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,9 @@
// Return a fibonacci sequence as an array
/**
* Return a fibonacci sequence as an array.
*
* @param n
* @return {number[]}
*/
export default function fibonacci(n) {
const fibSequence = [1];

View File

@ -1,4 +1,9 @@
// Calculate fibonacci number at specific position using Dynamic Programming approach.
/**
* Calculate fibonacci number at specific position using Dynamic Programming approach.
*
* @param n
* @return {number}
*/
export default function fibonacciNth(n) {
let currentValue = 1;
let previousValue = 0;