What is Node.js?

Node.js is V8 (the JavaScript engine running inside Google Chrome) bundled together with a couple of libraries, mainly to do I/O – i.e. writing files and handling network connections.
It’s important to note that Node.js isn’t any special dialect of JavaScript – it is just normal, modern JavaScript, running everywhere instead of just the browser.

Node.js allows developers to use JavaScript everywhere instead of just in browsers – the two big mainstream uses as of writing are web/app servers (Node.js is very well-suited for messaging-like applications like chat servers, for example) and Internet of Things (running inside Arduino-like devices).

2.

Node.js is a Javascript free and open source cross-platform for server-side programming that allows users to build network applications quickly. Node.js. is a system that uses event-driven programming to build scalable applications and network programs. Node Js is Single threaded Platform which uses non-blocking I/O calls and especially helpful for building web servers.

Node.js allows the developer to run JavaScript in the back end, away from the browser. Node.js interprets and executes JavaScript in the back end using Google’s V8 VM.Node.js is a stripped-down, highly customizable server engine. This proto-server processes in a loop, ready to accept and respond to requests. Any of those requests themselves may initiate other requests to some other part of the system, such as to read a file off of disk or to send a signal to spin a motor on a robot arm. That loop, known as the event loop, is the “runtime” part.

3.

NodeJS is a runtime environment, it is software that allows applications written in javascript to be executed on the underlying OS.

In order to do so, it uses Chrome’s V8 Javascript engine. V8 is written with C++ and goes through a set of stages to interpret Javascript as a language:

  • Lexer: reads the source code, creates tokens from keywords and identifies variables and values;
  • Parser: analyzes the “grammar” (e.g. the recognition of variable/function declarations) based on these tokens and creates syntax (parse) trees to do so;
  • Interpreter: V8 doesn’t use standard interpretation (translating every line of source code into machine code line by line), but uses
    • (edited) A full compiler which produces native machine code as quickly as possible. It produces the “base code”, doesn’t use bytecode, and does not focus on any optimization;
    • JIT (just-in-time) compilation to increase performance by optimizing hot functions. Edit: V8 doesn’t seem to use bytecode at all;
  • Runtime: Bridging: System information (e.g. math or time functionality) is brought to the Javascript world through system libraries (written in C or C++);

Additionally, V8 adds performance optimization by:

  • The use of hidden classes to speed up dictionary lookups that come with Javascript objects (which is slow by default);
  • Apply tagging to efficiently represent numbers when types change;

    Conclusively, it allows people to run software written in Javascript on the server (or any other environment) and exposes some built-in functionality as a part of the runtime.

    I hope that this has brought closer insight in contribution to what has already been said.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s