Home  >  Article  >  Web Front-end  >  JavaScript - Pioneers of Netscape Nodejs

JavaScript - Pioneers of Netscape Nodejs

王林
王林Original
2024-08-12 18:34:50268browse

Ref: http://blog.kueiapp.com/programming-tw/javascript-PIONEERS-netscape-nodejs/

JavaScript 1.0

JavaScript - 的先鋒者們Netscape Nodejs

JavaScript 1.0 was invented by Brendan Eich of Netscape in 1995 for the famous browser Netscape. Java was a very popular language at that time, so Netscape wanted to be as cool as it was and named it JavaScript. However, they have absolutely nothing to do with each other.

Microsoft released two languages ​​that can be executed on the browser in 1996, VBScript and JScript. JScript is actually a clone of JavaScript, used in Internet Explorer 3.

In order to formulate JavaScript standards, Netscape proposed the first global standardized architecture to ECMA International in 1996, and completed the first released version (ES1) in 1997. They call it ECMAScript, the global standard for JavaScript. From the first version to 2022, the most popular version is ECMAScript 2015 (also known as ES6), supported by the most browsers.

Different versions of JavaScript will have different syntax, functions, libraries or module systems. To check if our environment can perform it, caniuse.com is a great web information site.

ESMAScript (JavaScript) Candidate List

  • 5th edition: ES5
  • ES6 — ECMAScript 2015
  • ES7 — ECMAScript 2016
  • ES8 — ECMAScript 2017
  • ES9 — ECMAScript 2018
  • NodeJS

In 2008, Google released the Chrome browser, and its JavaScript V8 rendering engine dropped a shock bomb to the online world. Due to the "open source" nature of V8, the NodeJS team modified the engine so that it can easily handle web applications and create servers for back-end applications.

JavaScript module

Due to the emergence of NodeJS, the application of JavaScript is not limited to browsers. Server-side service providers can also use JavaScript. Coding style is not limited to web formats, and many NodeJS applications bring the concept of module programming into the JavaScript world.

Different from the function library, when talking about a module Module, it usually contains a category or a set of functions to achieve a certain purpose. Furthermore, since the JavaScript world is a free and open platform, there are many styles of Modules in JavaScript.

  • CommonJS
  • UMD — Universal Module Definition
  • AMD
  • Require.js
  • ES6 module

As time goes by, import and require become the two mainstream modes when using JavaScript Modules.

require

CommonJS style is the earliest writing method that gave rise to the concept of modules.

// a.js
const module = require('module');
module.hello()
// module.js
function hello(){ console.log('hello') }
module.exports = { hello }

import

In the latest ES6 standard, modules can be written as import and export, which seems easier to understand.

// a.js
import module from "module"
module.hello()
// or
import { hello } from "module|
// module.js
export function hello(){ console.log('hello') }
// or
export { hello }

Using NodeJS

JavaScript - 的先鋒者們Netscape Nodejs

NodeJS is an independent execution environment. After installation, we can use the node command to execute JavaScript code in the terminal without a browser.

  • Download and install from nodejs.org
  • Install from a package management system, such as HomeBrew brew install node for macOS
node hello.js
// or omit the extension
node hello

Ref: http://blog.kueiapp.com/programming-tw/javascript-PIONEERS-netscape-nodejs/

The above is the detailed content of JavaScript - Pioneers of Netscape Nodejs. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn