NodeJS >> Node.js VS JavaScript
Table of Contents
In this article, we will compare Node.js with JavaScript.
What is Node.js?
Node.js is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Chrome V8 is a JavaScript engine that is used by Chrome and other browsers writen by C++.
It is designed based the non-blocking I/O model of the event-driven programming style so it is suitable for building scalable network applications with event-driven I/O. It can handle a large number of requests per second with a single thread concurrently.
Advantages of Node.js
- It is non-blocking I/O model of the event-driven programming style, so it is suitable for building scalable network applications with event-driven I/O.
- It is lightweight, so it is suitable for embedded applications.
- It is cross-platform, so you only write once and run on all platforms.
- It is fast, so it is suitable for real-time applications.
- It is easy to install and use, so it is suitable for developers who are new to programming.
- It is easy to learn, if you are familiar with JavaScript, it is easy to learn Node.js.
- It is open source, so it is free to use.
Disadvantages of Node.js
- Its consitency is not guaranteed, so it is not recommended to use it in a frequently changing environment.
- It is not multi-threaded, so it is not suitable for computing intensive tasks.
- It lacks well-designed libraries, so it is difficult for developers to implement some basic features.
Node.js is suitable for?
- Games with multi-player support
- Collaborative applications with multiple users
- Application with streaming data
- Chat applications
- Web API
- Real-time applications
Who use Node.js
A lot of big companies use Node.js.
- Uber
- Netflix
- Trello
- Medium
- Walmart
- eBay
- PayPal
- Mozilla
What is JavaScript?
JavaScript (often abbreviated JS) is a programming language (scripting language) that is used to create dynamic web pages.
JavaScript is a client-side scripting language and it is interpreted by browsers.
JavaScript is a high-level, dynamic, untyped, and interpreted programming language.
JavaScript was invented by Brendan Eich in 1995. It was developed for Netscape 2, and became the ECMA-262 standard in 1997.
JavaScript conforms to the ECMAScript specification.
Advantages of JavaScript
- It is easy to learn, if you are familiar with C, it is easy to learn JavaScript.
- It is very popular, so there are many communities and learning stuff.
- It is cross-platform, so you can use it on all modern browsers.
- It is a web-oriented language, so it is suitable for web development.
- It is supported by a lot of global companies, such as Google, Facebook, and Microsoft.
- There are a lot of open source projects written by JavaScript.
- There are a lot of popular libraries written by JavaScript.
Disadvantages of JavaScript
- There are many security risks because it is a client-side scripting language.
- The Javascript version and api are different on different browsers becuase the support speed and implemented features are different on different browsers.
- It is difficult to debug sometimes.
- It has a lot of versions, so it is hard to maintain sometimes.
JavaScript is suitable for?
- Web applications (adding interactive features to web pages)
- Mobile applications (with such as React Native)
- Desktop applications (with such as Electron)
- Games (especially web page games)
Who use JavaScript?
Almost all companies use JavaScript.
Because at least they need use JavaScript in their official websites. :)