JavaScript Error Handling Part – 1

Free Web development courses with real-time projects Start Now!!

Program 1

<html>
    <head>
        <script>
            try   //find out error
            {
                console.log("Line of try before error")
                 hello()    //error
                 console.log("next line of try after error")
                 console.log(100+100)
            }
            catch(e)                                               // to handel to error
            {
                console.log(e.name)
                console.log(e.message)
                console.log(e.stack)
            }
            finally
            {
                console.log("*********This is finally block************")
            }
             console.log("After try finally.......... ")
             console.log(500+500)
             
        </script>
    </head>
 
    <body>
      <center>
       <h1>Check error in code</h1>
     </center>
    </body>
</html>

Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

courses

Leave a Reply

Your email address will not be published. Required fields are marked *