Unexpected end of input – beginner js

Hey I just started learning js today. I’m trying to write a basic ‘fizzbuzz’ program that goes up to a certain number inputted by the user. However, the final squiggly bracket of the ‘for loop’ is not working. It it just wrong syntax or is it an issue with js?

function fizzbuzz(num) {
    if (num % 15 == 0) {
        return "fizzbuzz";
    } else {
        if (num % 3 == 0) {
            return "fizz";
        } else {
            if (num % 5 == 0) {
                return "buzz";
            } else {
                return num;
            }
        }
    }

let answer = parseInt(prompt("Please enter the number you would like to fizzbuzz up to: "));

for (let i = 1; i <= answer; i++) {
    console.log(fizzbuzz(i))
}

I’ve tried reformatting the ‘for loop’ as well as putting a semi-colon at the end of the console.log.