I'm trying to write an if/else statement in Javascript that plays an mp3 audio file when a condition is true. I just want it to start playing without a button like some of the other codes I've seen on here. This is an example of what I have so far.
var name = function(code) {
if('Hi.'){
console.log("Hello.");}
//This is where I want to add an audio file
else if('Good morning.'){
console.log("How are you today?");}
//This is also where I want to add a file