Java
Script Online
Clear Console
Run Code
Save Code
Keyboard Shortcuts
View Github
Main Website
/* Welcome to Javascript Online! Here, you'll find a convenient place to tryout javascript algorithms / learn javascript. If you have any questions, feel free to email me at contact@ronakshah.net If you have any feature requests, please submit an issue request on Github */ /* Returns the specified term of the fibonacci sequence */ function fib(termNum) { if (termNum == 0 || termNum == 1) { return termNum } else { return fib(termNum -1) + fib(termNum -2) } } //prints terms of the fibonacci sequence from the initial term to the 9th term for (var n = 0; n < 10; n++) { console.log(fib(n)) }
Keyboard Shortcuts
ctrl-enter
or
cmd-enter
: Run Code
ctrl-l
or
cmd-l
: Clear Console
ctrl-s
or
cmd-s
: Save Code