examples/math/src/math.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 2

Size

Lines of Code 12
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 4
mnd 2
bc 2
fnc 2
dl 0
loc 12
bpm 1
cpm 2
noi 1
c 0
b 0
f 0
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A math.js ➔ fibonacci 0 3 2
1
/**
2
 * calculate facorial of the number
3
 * @param {number} num
0 ignored issues
show
Documentation introduced by
The parameter num does not exist. Did you maybe forget to remove this comment?
Loading history...
4
 * @returns {number} facorial of the number
5
 */
6
export function factorial(n) {
7
    return (n > 1) ? n * factorial(n - 1) : 1;
8
}
9
10
/**
11
 * calculate Fibonacci Sequence
12
 * @param {number} num
13
 * @returns {number} Fibonacci number
14
 */
15
export function fibonacci(n) {
16
    return n <= 1 ? n : fibonacci(n - 1) + fibonacci(n - 2);
17
}
18