What is the difference between javascript and es6
The difference between javascript and es6: 1. JavaScript is a dynamically typed, weakly typed, prototype-based client-side scripting language, used to add dynamic functions to HTML web pages. es6 is the next generation standard of JavaScript language; 2 , es6 is the language specification of JavaScript, and JavaScript is an implementation of es6.
The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.
What is the difference between javascript and es6
What is JavaScript
JavaScript is a dynamic type, weak type, based on Prototype client-side scripting language, used to add dynamic functions to HTML web pages
Dynamic: determine the data type at runtime. There is no need for a type declaration before a variable is used. Usually the type of the variable is the type of the value to which it is assigned.
Weak class: During calculation, implicit conversion between different types can be transparent to the user. Even if the type is incorrect, the correct type can be obtained through implicit conversion.
Prototype: The new object inherits the object (as a template) and shares its own properties with the new object. The template object is called a prototype. In this way, after the new object is instantiated, it can not only enjoy the properties defined when it is created and run time, but also the properties of the prototype object.
What is ES6
ECMAScript 6.0 (hereinafter referred to as ES6) is the next generation standard of the JavaScript language (now following the ES5 standard), which was officially launched in June 2015 announced. Its goal is to enable the JavaScript language to be used to write complex large-scale applications and become an enterprise-level development language.
New features of ES6
#The let command in ES6 declares variables. The usage is similar to var, but let is new for JavaScript. Block-level scope, there is no block-level scope in ES5, and var has the concept of variable promotion, but in let, the variables used must be declared.
Destructuring assignment of variables in ES6, for example: var [a,b,c] = [0,1,2];
ES6 no longer uses the prototype chain to implement inheritance like ES5, but introduces the concept of Class, which sounds somewhat similar to the syntax of object-oriented programming in Java, but the two are different.
The function definition in ES6 no longer uses the keyword function, but uses => for definition;
In ES6 Default function parameters can be set, such as function A (x, y=9) {};
The relationship between ECMAScript and JavaScript
Because JavaScript Due to copyright issues with the creator Netscae Corporation, ECMAScript cannot be called Javascript. In short, the relationship between ECMAScript and JavaScript is that the former is the specification (language specification) of the latter, and the latter is an implementation of the former.
Extended knowledge
ES6 features are as follows:
1. Block-level scope keyword let, constant const
2. Property value shorthand for object literals
var obj = { // __proto__ __proto__: theProtoObj, // Shorthand for ‘handler: handler’ handler, // Method definitions toString() { // Super calls return "d " + super.toString(); }, // Computed (dynamic) property names [ 'prop_' + (() => 42)() ]: 42 };
3. Assignment deconstruction
let singer = { first: "Bob", last: "Dylan" }; let { first: f, last: l } = singer; // 相当于 f = "Bob", l = "Dylan" let [all, year, month, day] = /^(dddd)-(dd)-(dd)$/.exec("2015-10-25"); let [x, y] = [1, 2, 3]; // x = 1, y = 2
4. Function parameters - default value, parameter packaging, array expansion ( Default, Rest, Spread)
//Default function findArtist(name='lu', age='26') { ... } //Rest function f(x, ...y) { // y is an Array return x * y.length; } f(3, "hello", true) == 6 //Spread function f(x, y, z) { return x + y + z; } // Pass each elem of array as argument f(...[1,2,3]) == 6
[Related recommendations: javascript video tutorial, web front-end]
The above is the detailed content of What is the difference between javascript and es6. For more information, please follow other related articles on the PHP Chinese website!

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics



How to use WebSocket and JavaScript to implement an online speech recognition system Introduction: With the continuous development of technology, speech recognition technology has become an important part of the field of artificial intelligence. The online speech recognition system based on WebSocket and JavaScript has the characteristics of low latency, real-time and cross-platform, and has become a widely used solution. This article will introduce how to use WebSocket and JavaScript to implement an online speech recognition system.

WebSocket and JavaScript: Key technologies for realizing real-time monitoring systems Introduction: With the rapid development of Internet technology, real-time monitoring systems have been widely used in various fields. One of the key technologies to achieve real-time monitoring is the combination of WebSocket and JavaScript. This article will introduce the application of WebSocket and JavaScript in real-time monitoring systems, give code examples, and explain their implementation principles in detail. 1. WebSocket technology

Introduction to how to use JavaScript and WebSocket to implement a real-time online ordering system: With the popularity of the Internet and the advancement of technology, more and more restaurants have begun to provide online ordering services. In order to implement a real-time online ordering system, we can use JavaScript and WebSocket technology. WebSocket is a full-duplex communication protocol based on the TCP protocol, which can realize real-time two-way communication between the client and the server. In the real-time online ordering system, when the user selects dishes and places an order

How to use WebSocket and JavaScript to implement an online reservation system. In today's digital era, more and more businesses and services need to provide online reservation functions. It is crucial to implement an efficient and real-time online reservation system. This article will introduce how to use WebSocket and JavaScript to implement an online reservation system, and provide specific code examples. 1. What is WebSocket? WebSocket is a full-duplex method on a single TCP connection.

JavaScript and WebSocket: Building an efficient real-time weather forecast system Introduction: Today, the accuracy of weather forecasts is of great significance to daily life and decision-making. As technology develops, we can provide more accurate and reliable weather forecasts by obtaining weather data in real time. In this article, we will learn how to use JavaScript and WebSocket technology to build an efficient real-time weather forecast system. This article will demonstrate the implementation process through specific code examples. We

JavaScript tutorial: How to get HTTP status code, specific code examples are required. Preface: In web development, data interaction with the server is often involved. When communicating with the server, we often need to obtain the returned HTTP status code to determine whether the operation is successful, and perform corresponding processing based on different status codes. This article will teach you how to use JavaScript to obtain HTTP status codes and provide some practical code examples. Using XMLHttpRequest

Usage: In JavaScript, the insertBefore() method is used to insert a new node in the DOM tree. This method requires two parameters: the new node to be inserted and the reference node (that is, the node where the new node will be inserted).

JavaScript is a programming language widely used in web development, while WebSocket is a network protocol used for real-time communication. Combining the powerful functions of the two, we can create an efficient real-time image processing system. This article will introduce how to implement this system using JavaScript and WebSocket, and provide specific code examples. First, we need to clarify the requirements and goals of the real-time image processing system. Suppose we have a camera device that can collect real-time image data
