Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript ReferenceError</title> </head> <body> <script> var firstName = "Harry"; try { document.write(firstname); // throws a reference error (variable names are case-sensitive) } catch(e) { document.write(e.name + ": " + e.message); } </script> </body> </html>