When I was younger, I decided not to leave my room to play, to do nothing outside my room, because I was scared of things outside. My brother relieved me of this by making a tent outside identical to my room with pillows and pictures hung in the center. JavaScript was once like me.
JavaScript is a scripting language. This means that it was made to function only in a specific environment, to play in a special playground. This environment breathes air into the lungs of JavaScript. Different environments exist for different browsers . In Chrome, the environment is called the V8 engine.
The cool thing is that the V8 engine is independent of the browser in which it's hosted i.e. it can exist on it's own outside the browser. In 2009, a software engineer called Ryan Dahl took advantage of this to make what is called NodeJS.
NodeJS is a special playground built around the same slide,V8 engine, which allows JavaScript play and make more fun stuff outside of the browser. Instead of Dahl copying the whole browser using JavaScript i.e. making a user interface, he copied what made JavaScript work in the browser and built an environment for JavaScript based on this engine.
This showed developers that JavaScript can JavaScript on the server and ever since, more apps use JavaScript on the backend. NodeJS became popular for it's speed , adaptability and the fact that it allows developers work on both front and back end with one language.
This is the beauty of the special playground called V8.