DEV Community

Cover image for Differences between Javascript and NodeJs
Maria Antonella πŸ¦‹
Maria Antonella πŸ¦‹

Posted on

Differences between Javascript and NodeJs

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 understand what each one was used for. For this reason, I share it :)

☘ JavaScript is a language that runs inside web browsers as part of the documents loaded by the browser and is used as a client-side development language. It provides the behavior of the pages. Like HTML it provides the semantic structure and CSS the look and feel.

However, being an interpreted language, it needs an interpreter to run. V8 is Google Chrome's JS engine and 'node' is a front-end that can be used to run JavaScript scripts outside the browser. In other words:

☘ NodeJs is an open source, cross-platform environment that allows you to create server-side applications and tools using JavaScript.

A short list of comparisons πŸ§πŸ’»:

JS
πŸ”΄ Can only be run in the browsers
πŸ”΄ Used on the client-side
πŸ”΄ Capable enough to add HTML and play with the DOM
Enter fullscreen mode Exit fullscreen mode
NodeJs
🟑 Can be run outside the browser
🟑 Used on the server-side.
🟑 Does not have the capability to add HTML tags
Enter fullscreen mode Exit fullscreen mode

Discussion (12)

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 πŸ¦‹ Author

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.

Collapse
maixuanhan profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Han Mai

Crap comparison

Collapse
antoomartini profile image
Maria Antonella πŸ¦‹ Author

Your comment reflects who you are. Have a nice day :)

Collapse
maixuanhan profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Han Mai

Who am I? You couldn’t even distinguish between languages and applications that’s why this comparison is crap. πŸ™‚

Thread Thread
antoomartini profile image
Maria Antonella πŸ¦‹ Author

Because your comments should be constructive. We are in a community. That means we help each other. Don't think you are better than someone else.
And insulting someone else's work. I imagine that one day you started to learn without knowing anything. Respect others. Respect those of us who learn every day.
I hope you get better as a person and professional :)

Thread Thread
maixuanhan profile image
Comment marked as low quality/non-constructive by the community. View Code of Conduct
Han Mai

It is a constructive feedback, criticize one. It is you not taking it well. Don’t bla bla about other people, it’s none of your business. Last free advice: concentrate on your learning, making better posts and improving low quality posts especially craps πŸ™ƒ

Thread Thread
stevehoskins profile image
Steve Hoskins

I am looking through sites, including this one obviously, for tips and inspiration. As a new learner it is all interesting and new to me. Thank you Maria for anything you share, and Han Mai, I would appreciate it if you either contribute politely or keep your bitterness to yourself.
Steve