<script type="text/javascript"> document.write("My My value is " + myVariable); </script>
Above line will gives you an error because you have not defined the variable name. you can catch this error in try catch block as below![]()
<script type="text/javascript"> try { document.write("My value is " + myVariable); } catch(err) { document.write("There is an undeclared variable ..but hey"+, "don't let that stop you!"); } </script>