JS code does not print any output when it’s supposed to

So, my JS code doesn’t run because of an error, and I have no idea what the error is.
Here’s the code:

javascript

var name = 'anyName'
var score = 0

if (score < 1) {
    function1()
}

function function1() {
    prompt('Enter something')
    score++;
    function2()
}

function function2() {
    if (score < 100 && score < 300) {
        function1()
    }
}

while (score < 9000 && true) {
    function1()
}

print("Your score is: " + score + ". Your username: " + name + ".")

It’s not in an html code so I have NO idea what’s going on.

I was expecting the following output:

Your score is: score. Your username: name.

If there is an answer, I would appreciate it.