I'm pretty new to JavaScript.
I'm trying to define my custom errors, but it doesn't seems to be working
function MyError(msg){
this.message = msg
this.name = "My Error"
}
window.onload = function(){
try{
throw new MyError("Test Message");
} catch(e) {
alert(e.name + ": " + e.message);
}
}
Getting TypeError, claiming that it's not a function.