JavaScript Coding Style, Error handling

JavaScript Coding Style

Code must be as clean for an easy read as possible.

JavaScript Error Handling — try…catch

Syntex:

try..catch
  1. If any error find then executed the code in a catch (err){…}
  2. If there are no errors then skip the catch(err){…}
  3. try…catch only works for runtime error
  4. try…catch works synchronously
  • message — error textual message
  • stack — current call stack

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store