Home » Programming » Javascript » Javascript Vs Nodejs

The Difference Between JavaScript and Node.js – Which Should I Use?

This article explains JavaScript and Node.js and their relationship with each other.

What is JavaScript?

JavaScript has become one of the most popular programming languages for building web applications and has even become a contender for building solid desktop and mobile applications.

In the browser, there is no competitor – browsers run JavaScript for their client-side code- allowing them to pop up windows, disable buttons, animate screen elements, and retrieve data. This is what JavaScript was built for.

What is it Good For?

JavaScript Runs in the web browser. When you’re thinking of using JavaScript, you’re thinking of:

  • Anything done in the user’s web browser (surprise!)
  • Displaying user interfaces
  • Validating form inputs before they are submitted
  • Animating page elements
  • Hiding and showing things
  • Getting data from external services for display on a page

What is Node.js?

JavaScript was not designed for hosting web servers and running API backends. It was intended only for running inside a browser to add functionality to web pages.

NodeJS turned this on its head– changing JavaScript from a client-side language for making interactive web page elements to a fully-fledged programming environment.

It’s the same JavaScript language with the same syntax, just running in a different place.

The Node.js runtime allows JavaScript code to be run outside of a web browser.

What is it Good For?

Node.js set JavaScript loose on the world without a web browser’s constraints, and people have gone absolutely nuts with it. You can now use JavaScript to do just about anything by running your JavaScript code in Node.js.

  • Anything not done in the user’s web browser
  • Node.js can be used to serve web pages or complex web applications
    • These can contain their own client-side JavaScript code allowing a user-facing JavaScript app to access data provided from a Node.js service
  • Command-line applications
  • Desktop applications and mobile apps
  • Web APIs to read and update data from a database
  • Interacting with hardware – automation, sensors, buttons
    • There are even Node.js libraries for interacting with Raspberry Pi input/output hardware.

In the desktop/mobile app space, JavaScript in the Node.js environment has become a flexible tool for building cross-platform applications. It is also finding uses in data analytics, tinkering, robotics – it’s just everywhere now.


Both JavaScript and Node.js are JavaScript. JavaScript was originally built for use in web pages running in a web browser. Node.JS lets it run without that constraint.

Photo of author
I'm Brad, and I'm nearing 20 years of experience with Linux. I've worked in just about every IT role there is before taking the leap into software development. Currently, I'm building desktop and web-based solutions with NodeJS and PHP hosted on Linux infrastructure. Visit my blog or find me on Twitter to see what I'm up to.

Leave a Comment