I have the following code:
var soundManager = {
var _explode = new Audio('/Content/sounds/explosion.ogg');
var _coin = new Audio('/Content/sounds/coin.ogg');
this.play = function (name){
switch(name){
case "explosion":
_explode.play();
break;
case "coin":
_coin.play();
break;
}
};
};
Chrome says I have an error on the second line, where _explode is defined. What's the syntax error? I'm trying to set it up so I can call soundManager.play(nameOfSound) to have it play an ogg file.
Thank you.
-Nick