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!

去掉重复并排序的方法:1、使用“Array.from(new Set(arr))”或者“[…new Set(arr)]”语句,去掉数组中的重复元素,返回去重后的新数组;2、利用sort()对去重数组进行排序,语法“去重数组.sort()”。

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于Symbol类型、隐藏属性及全局注册表的相关问题,包括了Symbol类型的描述、Symbol不会隐式转字符串等问题,下面一起来看一下,希望对大家有帮助。

怎么制作文字轮播与图片轮播?大家第一想到的是不是利用js,其实利用纯CSS也能实现文字轮播与图片轮播,下面来看看实现方法,希望对大家有所帮助!

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于对象的构造函数和new操作符,构造函数是所有对象的成员方法中,最早被调用的那个,下面一起来看一下吧,希望对大家有帮助。

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于面向对象的相关问题,包括了属性描述符、数据描述符、存取描述符等等内容,下面一起来看一下,希望对大家有帮助。

方法:1、利用“点击元素对象.unbind("click");”方法,该方法可以移除被选元素的事件处理程序;2、利用“点击元素对象.off("click");”方法,该方法可以移除通过on()方法添加的事件处理程序。

本篇文章给大家带来了关于JavaScript的相关知识,其中主要介绍了关于BOM操作的相关问题,包括了window对象的常见事件、JavaScript执行机制等等相关内容,下面一起来看一下,希望对大家有帮助。

foreach不是es6的方法。foreach是es3中一个遍历数组的方法,可以调用数组的每个元素,并将元素传给回调函数进行处理,语法“array.forEach(function(当前元素,索引,数组){...})”;该方法不处理空数组。


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 Linux new version
SublimeText3 Linux latest version

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

Atom editor mac version download
The most popular open source editor

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment
