Node environment vs Browser environment

Mon Oct 13 2014

Paul Shan

Node and web browsers, both executes JavaScript, but Node does that in server side and browsers in client side. Node uses the same JavaScript engine which is the backbone of Chrome, but still we can find few differences between Node and Browser.
Node Browser
 Node doesn't have a predefined "window" object cause it doesn't have a window to draw anything.  "window" is a predefined global object which has functions and attributes, that have to deal with window that has been drawn.
 "location" object is related to a particular url; that means it is for page specific. So, node doesn't require that.  "location" is another predefined object in browsers, that has all the information about the url we have loaded.
 Ofcourse Node doesn't have "document" object also, cause it never have to render anything in a page.  "document", which is also another predefined global variable in browsers, has the html which is rendered.
 Node has "global", which is a predefined global object. It contains several functions that are not available in browsers, cause they are needed for server side works only.  Browsers may have an object named "global", but it will be the exact one as "window".
 "require" object is predefined in Node which is used to include modules in the app.  Browsers don't have "require" predefined. You may include it in your app for asynchronous file loading.
 In Node everything is a module. You must keep your code inside a module.  Moduling is not mandatory in client side JavaScript, i.e. in browsers.
 Node is headless.  Browsers are not headless.
 Node processes request object.  Browsers processes response objects.
As both of them are JavaScript executor, and Node uses the JavaScript engine of a browser (Chrome), so differences are not much there. It is just the Node wrapper which has been written on top of  JavaScript V8 Runtime engine, which is deleting few objects and also including some according to the requirement of Node.


Today everyone knows the importance of a lightning-fast website and how the speed impacts the conversion rate of a business. Today, everyone wants the site to be a PWA so that the mobile users can have an app-like experience with the website because, for the majority of the merchants, the customers come through mobile devices.
Tue Apr 20 2021
Here we are going to see how you can manage backup and restore of Postgres database with docker.
Thu Sep 03 2020
Image sliders or carousels always have increased the UI attraction of websites and they are pretty useful for reflecting the major roles/products too. In case, I am having a website that sells tee-shirts,
Mon Apr 30 2018

About VoidCanvas

This blog was created out of hobby and talks mostly about technology, web development, JavaScript, NodeJS and related topics. Thank you for reading my blog.

Copyright 2022 -

Popular Articles

Authentication using Google's oAuth api with node.js

Thu Mar 10 2016

OAuth authentications are pretty popular now a days and another thing which is popular is JavaScript. This article shows how to plugin google’s oAuth api for authentication in your own node application.

CSS3 Loader Snippet Collection: (Part 2 - Squares)

Sat Mar 01 2014

This is a continuation of my CSS3 loader snippet collection series. I've provided spinning css3 animation loader in the part 1 of this series and here in part 2, I'm providing various square type loading