forked from bethrobson/Head-First-JavaScript-Programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfibonacci.html
More file actions
22 lines (21 loc) · 387 Bytes
/
fibonacci.html
File metadata and controls
22 lines (21 loc) · 387 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title> Computing Fibonacci numbers recursively </title>
<script>
function fibonacci(n) {
if (n === 0 || n === 1) {
return 1;
} else {
return (fibonacci(n-1) + fibonacci(n-2));
}
}
for (var i = 0; i < 10; i++) {
console.log("The fibonnaci of " + i + " is " + fibonacci(i));
}
</script>
</head>
<body>
</body>
</html>