How to get audio snippet to play on a condition

So basically I’m just trying to have some fun and do something goofy. I’m in the early stages of my learning so naturally, I’m curious about what I can do.

I made a simple calculator and I want a sound to play if the user adds 420 and 69 together.

Really dumb I know. I think it’s hilarious.

Anyways, I put this code in and I got the sound to play but it starts as soon as I load the page.

     var audio = new Audio("UH OH.mp3");
     audio.play();

What I want to do is for the sound to play only if the calculator gets 489 as a result.

    var audio = new Audio('UH OH.mp3');
    if (currentOperandTextElement == 489) {
    audio.play();
    }

I thought that would work but because I’m a noob I can imagine there’s more to it than that. I tried to figure it out myself but I just want to know so I can learn something.