Let's dissect one possible solution:
function fibonacci(num) {
let a = 1, b = 0, temp
while (num >= 0) {
temp = a
a = a + b
b = temp
num--
}
return b
}
let response = prompt("How many numbers?")
alert(`The Fibonacci number is ${fibonacci(response)}`)
Let's take a look at the lines outside of the function first. All we're doing is simply asking the user for the point in the sequence up to which they'd like to calculate. The response variable is then fed into the alert() statement as a parameter to fibonacci, which takes the argument of num. From that point forward, the while() loop executes on num, decrementing num as the value of b is incremented according to the algorithm, and then finally returns into our alert message.
So that's really all there is to it! Now, let's try a variant because we never know what our user will input. What happens if they enter a string instead of a number? We should...