It is necessary to write a function that generates sequentially the numbers of the Fibonacci series.
At the user's request, the element numbers using the written function display the elements of the Fibonacci series until the user stops requesting them
It turned out to implement this task, but the series becomes visible only after the end of the requests:
var fibonacci = [0, 1]; do { var n = +prompt("Введите значение",""); Fib(n); } while (n>0); function Fib() { for (i = 2; i < n; i ++) { fibonacci[i] = fibonacci[i-1] + fibonacci[i-2]; } document.write(fibonacci.slice(n-1,n) + '<br>'); }