DEV Community

Cover image for Differences between Javascript and NodeJs

Differences between Javascript and NodeJs

Maria Antonella 🦋 on August 22, 2021

At first it was hard for me to understand the differences because for me, they were the same thing. It was all javascript. But then, I started to u...
Collapse
 
cerlancism profile image
Chen Yu • Edited

Javascript is just a programming language which can be used in any environment where a Javascript interpreter or runtime is available (noticed that I used "interpreter or runtime", as modern JS engines like V8, JS is actually compiled to bytecode rather than being actually interpreted). Welcome to the rabbit hole of JS! Browser and NodeJS are just the more common ones, there are many other environments such as Electron (Desktop Applications), React Native (Mobile Applications), MUJS etc, and these different environments define what you can do with it such as manipulating DOM or server side functions or more.

Collapse
 
machr profile image
Mark Powell

This GeekForGeeks article basically explains the same thing and it looks like you copied the comparisons from there anyway.

geeksforgeeks.org/difference-betwe...

I hope your post helps beginners though :)

Collapse
 
antoomartini profile image
Maria Antonella 🦋

Not actually, I took notes from other places. I didn't know of its existence. But I see that the link you share is more complete than mine!! There are things that I hadn't taken into account. Thank you! 😌😁

Collapse
 
hyoretsu profile image
Aran Leite • Edited

Uhm. Except JS is also run on Node. And Node's sort of a standalone V8. You also don't just "run JS in the browsers", you execute it the same way you can just pop up a node terminal and execute JS. Just like how you don't "run Node.js outside the browser" because by itself it doesn't do anything.

JS on the browser's also not more or less capable than in Node.js. The only difference is that one's in an environment that has a DOM while the other isn't.

Collapse
 
insidewhy profile image
insidewhy

You wrote that JavaScript "Can only be run in browsers"? but JavaScript runs in node, and node is not a browser.

Node also does have capabilities to add HTML tags, depending on how you look at things. Say... with SSR.

Collapse
 
sirajulm profile image
Sirajul Muneer

JS runs on both client and server.
NodeJS is just an engine made to run JS.
You are actually comparing a train to a rail track.