I am looking to create a Javascript function that will play a music file automatically after another function has finished execution. The desired behavior is for the "done.mp3" file to play upon successful completion and the "error.wav" file to play in case of an error.
This function should be simple and written purely in JavaScript. It can be called from anywhere, takes either an .mp3 or .wav file as input, and plays it immediately.
The end goal is to incorporate this into an ASP.NET project, ensuring compatibility with Internet Explorer, Firefox, and Chrome browsers.