// Create an object type UserException
function UserException (message){
this.message=message;
this.name="UserException";
}
// Make the exception convert to a pretty string when used as
// a string (e.g. by the error console)
UserException.prototype.toString = function (){
return this.name + ': "' + this.message + '"';
}//这怎么有点不懂呢,这是完成了什么功能?
将这段注销,区别在于抛出错误是否已一个结构体抛出(‘{}’),有没有人能解释一下
// Create an instance of the object type and throw it
throw new UserException("Value too high");