JavaScript is a dynamic language. This makes JavaScript a supercool language to start. However, It is very hard to write better and safe code. One small mistake can lead to a bigger issue. Error handling plays a vital role to reduce the number of bugs. If you handle error elegant way, it will save a lot of time in the future. So the bigger question is how you should handle the error.
Let’s take one example.
const express = require("express")
const app = express()
app.get("/", (_, res) => res.end("OK"))
app.listen(80)
The above code is a sample code written in nodejs on an express framework. In this code, I am trying to run a server at port 80.
Questions:
The output is very unclear while seeing this code. Even you want to handle an error, you may have to read the documentation. But don’t worry, just like any natural language. The programming language has some grammar.
ECMA, There is no particular specification/standard mentioned. However, the JavaScript community follows certain coding guidelines.
#javascript