Why node.js?

I love JavaScript alot. It is really a fun language.
However i always come to the term node.js.
I have been doing node.js course a little, its kind of fine.
But i do not see why i should use it. I probably love JS only.

Why should i use it?


Standard JS is compiled by and runs inside of your web browser, which is perfect for using it to make websites. What if, however, you wanted to run JS code locally, not with the help of a browser?

Well that’s where Node.JS comes in, Node is an environment that allows you to run JavaScript outside of a browser and that’s pretty important for a couple reasons:

  • It comes with NPM (the Node Package Manager) with allows you to very easily install and use packages and extra modules to expand what you’re able to do (for example, express is a module used to make a backend for a website).
  • Lots of major web frameworks (for example React/Next) cannot be immediately parsed and rendered by the browser, so a local environment running Node.JS is required to compile that code using a framework into vanilla HTML/JS that can be rendered.
  • If you want to make a project that uses only JS, it’s a little impractical to use the browser as the console in the browser isn’t ideal and in that cases, using Node.JS locally would be much easier imo.

Happy coding! :slight_smile: