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