Difference between JavaScript shell and node.js

17,118

Solution 1

JavaScript is a language. node.js is not a language or a special dialect of JavaScript - it's just a thingamabob that runs normal JavaScript.

All browsers have JavaScript engines that run the JavaScript of web pages. Firefox has an engine called Spidermonkey, Safari has JavaScriptCore, and Chrome has an engine called V8.

Node.js is simply the V8 engine bundled with some libraries to do I/O and networking, so that you can use JavaScript outside of the browser, to create shell scripts, backend services or run on hardware (https://tessel.io/).

Credits : https://www.quora.com/What-is-the-difference-between-JavaScript-and-Node-js

I hope that helped clearing out the basic difference between them. The specifics you required are not answered here.

Solution 2

Node.js enables JavaScript to be used for server-side scripting, and runs scripts server-side to produce dynamic web page content before the page is sent to the user's web browser.

Source: https://en.wikipedia.org/wiki/Node.js

Obviously the shell can not serve HTML web pages by itself.

In addition, Node.js is asynchronous, and non-blocking, meaning it can serve multiple requests and host multiple processes simultaneously.

EDIT: provided source.

Share:
17,118
Ashwin K Joseph
Author by

Ashwin K Joseph

Updated on August 02, 2022

Comments

  • Ashwin K Joseph
    Ashwin K Joseph over 1 year

    I am a new developer. I have been developing in Node.js for some time now. Today, I came across this article https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Introduction_to_the_JavaScript_shell#readline()

    It talks about javascript shell and goes onto say that it can execute javascript programs from a file as well.

    I was able to research and understand V8 and spydermonkey.

    I want to know the difference between Node.js and the javascript shell talked about in this article since it says that the shell can execute javascript programs on its own.

    Do they only differ in that the node.js uses a V8 engine while the other uses a spidermonkey?

    if so then why is it that node.js is so popularly used for writing Server Side JavaScript?

    I couldn't exactly find what I was looking for on the Internet. either google showed me difference between spidermonkey and v8 or some forums on "difference between javascript and node.js" and since I am a new developer its really hard for me to understand,

    So please be patient enough to consider this before down-voting this question, atleast explain your reasons in the comments

    Can spidermonkey be used to achieve the same?

  • Ashwin K Joseph
    Ashwin K Joseph almost 7 years
    nodejs does this by requiring the http right? so, cant a module similar to it be written, if not the same module, for the javascript shell? wouldnt it be able to listen to http requests then?
  • frozen
    frozen almost 7 years
    Node.js is a framework. The javascript shell is an execution environment. The execution environment can execute any javascript, including Node.js programs.
  • Ashwin K Joseph
    Ashwin K Joseph almost 7 years
    So i guess we can put it as node.js provides a runtime environment to run js files just as js shell does but along with it, it also provides extra libraries for i/o and expands the capabilities of the language. and nodejs implements the runtime by using the V8 engine