Errors – JavaScript Basics

try statement allows to analyse block of code for errors. catch statement allows to handle error. throw statement allows to create custom errors. finally statement allows to carry out code, after try & catch, regardless of result. Try and Catch JS statements try and catch come in pairs. try {     Block of code to try } catch(err) {     Block of code to handle

Continue reading Errors – JavaScript Basics

Switch Statement – JavaScript Basics

It is used to perform different actions on different conditions. How does it works?? – switch expression is classified once & value of expression is compared with values of each case. The associated block of code is executed if there’s a match. <!DOCTYPE html> <html> <body> <p id=”ex”></p> <script> var day; switch (new Date().getDay()) { case

Continue reading Switch Statement – JavaScript Basics