In last blog we learnt that what is node js ?, Node is runtime environment.
But what is run time environment really??
Well, before node we used JavaScript only to build
application that run inside as browser, so every browser having JavaScript
engine that takes JavaScript code and convert into machine code or code which
computer can understand and execute the code but what are the engine
which used by browser
Below is the list of browsers with their JS engine
- Microsoft edge uses chakra.
- Firefox uses Spider monkey.
- Chrome uses V8.
So due to variety of these engine some time JavaScript code behave
differently in one browser and another browser. Browser provide runtime environment
for JavaScript code.
document.getElementById('')
For e.g. in browser we have windows or document object these
object allows us to work with environment in which code is running.
Up to 2009 JavaScript code was running In browser, In 2009 Ryal dahl creator of node came up with brilliant idea. He thought let’s execute JavaScript outside the browser so he took google V8 engine which is the fastest JavaScript engine and embedded in C++ program called that programming node.
So similar to browser node is runtime environment for JavaScript code. It contains the JavaScript engine that can execute JavaScript code but it also have certain object that provide and environment for a JavaScript code but these object are different form environment object having a browser.
For
e.g. In node js we don’t have document object instead of that we have other object
which gives more interesting capability. For e.g. we can work with file system
or listing for request on given port and so on. We can’t do stuff like this on
browser.
So basically node is program that include JavaScript v8 engine plus some additional module that give us capability not available inside the browser we can work with the file system or the network and so on.
Chrome
and node share the same JavaScript engine but they provide diff runtime environment
for java script.
Node is not an programming language, Node is also not an framework it’s runtime environment for executing JavaScript code.
So don’t compare node js with C# and ASP.net
0 comments:
Post a Comment