Throwing user defined error in javascript

kammy

New Member
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:\[code\]function ain(){ var e = new Error("hello guys" ,12345); throw e;}(function() { try { ain(); } catch(e) { alert(e.number+" "+e.message); }}());\[/code\]The output is :\[code\]undefined hello guys\[/code\]
 
Top