Why wouldn’t the result display in the browser?

Using alert() in the switch statement works but why wouldn’t it display the result in the browser using the below code?

JS file:

do {
        let playerMove = prompt('Please enter your move', 'e.g rock, paper or scissors');
        let computerMove = ['rock', 'paper', 'scissors'];
        
        switch (playerMove){
            case 'rock':                
                document.querySelector('p').innerHTML= computerMove[Math.floor(Math.random()*3)] + ' vs  your rock';
                break;
            case 'paper':
                document.querySelector('p').innerHTML= computerMove[Math.floor(Math.random()*3)] + ' vs your paper';
                break;
            case 'scissors':        
                document.querySelector('p').innerHTML= computerMove[Math.floor(Math.random()*3)] + ' vs your scissors';
                break;
            default:
                document.querySelector('p').innerHTML= 'You need to learn how to play Rock, Paper, Scissors';
        }                       
    } while (confirm('Wanna play again?'))

HTML file:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h2>Rock Paper Scissors</h2>
    <p></p>
    <script src ='main.js'></script>
</body>
</html>