Visit Mozilla.org

Core JavaScript 1.5 Guide:TypeError

From MDC

[edit] TypeError Exception

Exceptions that throw a TypeError object will include the following properties in your Exception object:

  • message
  • fileName
  • lineNumber
  • stack
  • name

[edit] TypeError Example

var fn = function() {

};
try {
  fn.foo.bar();
}
catch (ex) {
  Log(ex);
  /*
    * message     | "fn.foo.bar is not a function"
    * fileName    | "http://localhost/test.html"
    * lineNumber  | 5
    * stack       | "@http://localhost/test.html:5\n"
    * name        | "TypeError"
  */
}

« Previous Next »