How is Nodejs different from Javascript?

Archita Mittal
3 min readDec 2, 2022

If you’re new to the world of Nodejs, a familiar question that might be haunting you at nights might be, is Nodejs same as javascript? if not, then what’s the difference between these two? In this article, we are going to explore these questions. To put your mind to ease slightly, let’s start with the first question. Are javascript and NodeJS the same thing? No, Nodejs and javascript are not synonyms, there are two different technologies, though related to some extent, but definitely not same. To understand what’s the difference between javascript and Nodejs is, we must first understand the what these technologies are and their functionalities are, which will help us draw a comparison between these two.

JAVASCRIPT

Javascript is a scripting language that allows us to manipulate the web pages, it allows us to introduce dynamic flavor to the static content. If you’re seeing pop ups on the web pages, dynamically updated content based on user input, then that’s javascript doing it’s work. Javascript uses the DOM API to manipulate the static HTML and CSS on the web page, and the browser is responsible for running all this code. If you want to write a javascript code, you can simply open up the console in your browser and get going.
Now that we have a brief understanding of what javascript is, let’s see what is Nodejs, and along it with try to understand the difference between the two.

NodeJS

Nodejs is a javascript runtime environment, yes it’s an environment, not a programming language as Javascript, it enables us to run javascript outside of the browser. Earlier while executed javascript code we were limited to the bounds of a browser, but Nodejs helps us breaks these shackles. Nodejs runs the v8 Javascript Engine, the core of Google chrome, outside the browser, allowing us to execute javascript code independent of the browser. Hence, we don’t need to learn a new language to learn NodeJS, people who have been writing client side javascript, can easily shift to Nodejs to write server side code. Now that we are discussing client and server side code, I would like to take a minute to discuss the difference between these two, because though they are mentioned frequently, but people aren’t usually aware of the meaning of these two ( Well, I wasn’t). Client side code means that the code is executed on the user’s computer. For instance, if we talk about plain javascript code in a web page, the code is first downloaded into the user’s computer and then excecuted on the user’s browser, whereas when we talk about server side code, as in the case of NodeJS, the code is executed on the server end, and the user is returned with the results.
There are additional features that are introduced as part of Nodejs that we weren’t able to use with plain javascript in the browser, such as interacting with the file system which wasn't possible when we were running javascript on the browser due to security reasons.

That’s a wrap on a quick distinction between javascript and NodeJS. Don’t forget to clap if you found this helpful.

--

--