ReferenceError: An illegal reference has occurred
You cannot use the value of a non-existing variable.
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> var x;/*from ww w . j a v a 2 s.c om*/ try { x = y + 1; } catch(err) { document.getElementById("demo").innerHTML = err.name; } </script> </body> </html>