javascript Write a function to calculate the specific number of a given position. E.g. the fibonacci sequence is … 1 1 2 3 5 8 13 … n code example
Example: fibonacci javascript
function fibonacci(num){
var num1=0;
var num2=1;
var sum;
var i=0;
for (i = 0; i < num; i++){
sum=num1+num2;
num1=num2;
num2=sum;
}
return num2;
}