Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript TypeError</title> </head> <body> <script> var num = 123; try { num.toLowerCase(); /* throws a type error (since toLowerCase() is a string method, a number can't be converted to lowercase) */ } catch(e) { document.write(e.name + ": " + e.message); } </script> </body> </html>