I am trying to throw an exception in javascript, I am trying to give exception a number along with the message, but i am only getting the message alone and not the number why? what am i doing wrong? my code is:
function ain()
{
var e = new Error("hello guys" ,12345);
throw e;
}
(function() {
try {
ain();
}
catch(e) {
alert(e.number+" "+e.message);
}
}());
The output is :
undefined hello guys