


What is the difference between js and node.js? Summary of similarities and differences between js and node.js
Do you know the difference between node.js and javascript? Do you know the similarities between node.js and javascript? If you don’t know, then come and read this article. What are you waiting for? Let’s read it now
1. Let’s first take a look at the comparison between js and node.js:
JavaScript:
ECMAScript (language basics, such as syntax, data type structure and some built-in objects)
DOM (some operation page elements Methods)
BOM (Some methods of operating the browser)
The above are the components of JavaScript, but what about Nodejs?
Nodejs:
ECMAScript (language basics, such as syntax, data type structures and some built-in objects)
os (operating system)
file(file system)
net(network system)
database(database)
Analysis: It is easy to see that the js of the front-end and back-end are the same That is, their language foundations are both ECMAScript, but the things they extend are different. The front end needs to operate page elements, so it extends the DOM, and it also needs to operate the browser, so it extends the BOM. The js on the server side is also based on ECMAScript and extends some APIs required by the server. Children who know a little about the background must know that the background voice has the ability of the operating system, so to expand os, you need to have the ability to operate files, so file is expanded. The file system needs to operate the network, so the net network system needs to be expanded, and the data needs to be operated, so the capabilities of the database need to be expanded.
After such a comparison, I believe many friends have a better understanding of nodejs. It turns out that the front-end and server-side js are so similar. Their foundations are the same, but the environments are different, which leads to different things they expand. (If you want to see more, go to the PHP Chinese website node.js video tutorial column to learn, you can also learn by watching the video)
2. Summary of similarities and differences between js and node.js:
Javascript composition: ecmascript (defines the basis of this language, such as syntax, data types, structures, and some built-in objects, etc.), DOM (based on ecmascript, extended methods for operating page elements) , BOM (based on ecmascript, extended methods for operating browsers).
nodejS is based on ECMASCRIPT, and then extended on this basis some methods to operate other things (that is, operate non-browsers), such as operating OS operating system, file file system, net network, database Database etc. In other words, nodejs and JS are the same at the bottom level, both are ecmascript, but the extended functions are different. One is biased towards front-end browsers, and the other is biased towards back-end.
In the ecmascript part, node and JS are actually the same, such as the definition of data types, syntax structures, and built-in objects. But the top-level object in js is the window object, but there is no window object in node. The top-level object in node is the global object. This is the difference between the two.
3. There are some differences that are easy to see:
JavaScript is a language
-
node.js is not a language, nor is it a special JavaScript dialect - it is just something used to run ordinary JavaScript code
All browsers run web pages JavaScript engine for JavaScript. Firefox has an engine called Spidermonkey, Safari has JavaScriptCore, and Chrome has V8
node.js is a V8 engine that can operate I/O and network libraries, so you can run it in the browser In addition, JavaScript is used to create shell scripts and background services or run on hardware
-
Javascript is a web front-end language, mainly used in web development, and is parsed and executed by the browser
Node.js is a platform that can quickly build network services and applications. It is a service platform built with Javascript language and can be used to build servers on the backend
They all use js syntax, the former is mainly used in front-end and the latter is mainly used in back-end
The difference between node.js and javascript is quite big, 1 platform, 1 platform Programming language;
javascript is a client-side programming language, which requires the browser's javascript interpreter for interpretation and execution;
node.js is a A platform built on the Chrome JavaScript runtime, it is a running environment that encapsulates the Google V8 engine;
Simply put, node.js encapsulates the browser's interpreter as The server running platform uses a JavaScript-like structural syntax for programming and runs on node.js.
The above is a summary of the differences, similarities and differences between node.js and js in this article (if you want to learn more, go to the node.js Chinese Reference Manual column on the PHP Chinese website ). The full text is easy to understand. If you have any questions, you can leave a message below.
【Editor’s Recommendation】
What are the advantages of node.js? An introduction to the advantages and disadvantages of node
What is node.js suitable for? What are the benefits of using node.js?
The above is the detailed content of What is the difference between js and node.js? Summary of similarities and differences between js and node.js. For more information, please follow other related articles on the PHP Chinese website!

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

JavaScript's applications in the real world include server-side programming, mobile application development and Internet of Things control: 1. Server-side programming is realized through Node.js, suitable for high concurrent request processing. 2. Mobile application development is carried out through ReactNative and supports cross-platform deployment. 3. Used for IoT device control through Johnny-Five library, suitable for hardware interaction.

I built a functional multi-tenant SaaS application (an EdTech app) with your everyday tech tool and you can do the same. First, what’s a multi-tenant SaaS application? Multi-tenant SaaS applications let you serve multiple customers from a sing

This article demonstrates frontend integration with a backend secured by Permit, building a functional EdTech SaaS application using Next.js. The frontend fetches user permissions to control UI visibility and ensures API requests adhere to role-base

JavaScript is the core language of modern web development and is widely used for its diversity and flexibility. 1) Front-end development: build dynamic web pages and single-page applications through DOM operations and modern frameworks (such as React, Vue.js, Angular). 2) Server-side development: Node.js uses a non-blocking I/O model to handle high concurrency and real-time applications. 3) Mobile and desktop application development: cross-platform development is realized through ReactNative and Electron to improve development efficiency.

The latest trends in JavaScript include the rise of TypeScript, the popularity of modern frameworks and libraries, and the application of WebAssembly. Future prospects cover more powerful type systems, the development of server-side JavaScript, the expansion of artificial intelligence and machine learning, and the potential of IoT and edge computing.

JavaScript is the cornerstone of modern web development, and its main functions include event-driven programming, dynamic content generation and asynchronous programming. 1) Event-driven programming allows web pages to change dynamically according to user operations. 2) Dynamic content generation allows page content to be adjusted according to conditions. 3) Asynchronous programming ensures that the user interface is not blocked. JavaScript is widely used in web interaction, single-page application and server-side development, greatly improving the flexibility of user experience and cross-platform development.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment