What is Node.js? Tutorials For Beginners - Part 1


what-is-nodejs-cheezycode-image


I have been searching for this answer. Being a .NET developer, I was curious to know what exactly is Node.JS or Node. If we go by the definition on its official website, it says - 

Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

This definition is not very clear from beginners standpoint. Lets try to understand what's inside Node.JS - 

1. Most of the browsers have some JavaScript Engine working behind the scenes. This engine is the main component of the browser that converts your JavaScript code into machine code. What it actually does is - it takes your JavaScript code, reads it, parses it and then compiles it into machine code. 

2. Chrome has V8 JavaScript Engine, Mozilla has Spider Monkey, Edge has Chakra and Safari has JavaScript Core JavaScript Engine. Every JavaScript engine has its own implementation that is why we face some JavaScript compatibility issues across the browsers.

3. In simple words, we can say that browser is a program which uses JavaScript engine and provides a way to run JavaScript code. i.e. it provides the environment by which you can run JavaScript code. Running JavaScript is not the only task that browser performs. They have additional tasks and features as well. Now let's talk about JavaScript specification. 

4. Each language has some specification i.e. rules and guidelines that it follows. ECMAScript is the specification for scripting languages and JavaScript follows this specification. It has various versions like ECMAScript 2015, ECMAScript 2016 and so on. JavaScript is one of the implementation of these specifications. Browsers are implementing the features specified in these specifications so that we can use latest features in our JavaScript code.

5. But what exactly does this specification covers? It just talks about the language features. You can refer the specification here. Few important questions before we move ahead - 
  • Does it contain how setTimeout should work? 
  • Does it contain how DOM manipulation should work?
  • Does it contain how to fetch data from server?

ANSWER IS NO 😮

Then who is providing the specification for these? Specification for these features is provided by W3C and WHATWG. These features are not part of JavaScript specification.

6. These are the APIs provided by browsers which are "accessed using JavaScript". Here comes another JavaScript incompatibility issue we face. Each browser has its own implementation for this as well. Let me give you one example of incompatibility in DOM Manipulation API - 

remove() is not supported in IE, it has removeNode() method to remove node from the DOM

But wait!! Are we not supposed to talk about NODE.JS 😳 ?

Yes, we are here to understand what is NODE.JS or NODE. But we need to have a clear idea about What is JavaScript ? What are Browser APIs? This will make our understanding clear about Node JS.

Let's summarize all of this - 

JavaScript is a scripting language that follows ECMAScript specification. ECMAScript only specifies language features not the browser APIs. Browser APIs are implemented by the browsers which are accessed via JavaScript. Browser APIs extends the JavaScript syntax to do certain things in the browsers. Browsers provide the environment where you can run your JavaScript and do tasks like - manipulating DOM, fetching data from server, play videos and audio etc. 

This is part 1 of this huge topic. For part 2 - stay tuned.

Happy Reading.

 

Comments

  1. Great Article. Thank you for sharing! Really an awesome post for every one.

    IEEE Final Year projects Project Centers in Chennai are consistently sought after. Final Year Students Projects take a shot at them to improve their aptitudes, while specialists like the enjoyment in interfering with innovation. For experts, it's an alternate ball game through and through. Smaller than expected IEEE Final Year project centers ground for all fragments of CSE & IT engineers hoping to assemble. Final Year Project Domains for IT It gives you tips and rules that is progressively critical to consider while choosing any final year project point.

    Spring Framework has already made serious inroads as an integrated technology stack for building user-facing applications. Spring Framework Corporate TRaining the authors explore the idea of using Java in Big Data platforms.
    Specifically, Spring Framework provides various tasks are geared around preparing data for further analysis and visualization. Spring Training in Chennai

    ReplyDelete

Post a Comment

Hey there, liked our post. Let us know.

Please don't put promotional links. It doesn't look nice :)

Popular posts from this blog

Just Maths - Views, View Groups and Layouts

Create Android Apps - Getting Started