Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Fibonacci Sequence in javascript

let fibo = [0, 1]
for (var i = 2; i <= 10; i++) {
    fibo[i] = fibo[i - 1] + fibo[i - 2];
}
console.log(fibo)
//Output: [ 0, 1,  1,  2,  3,5, 8, 13, 21, 34, 55]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Fibonacci #Sequence #javascript
ADD COMMENT
Topic
Name
2+2 =