当前位置:网站首页>JS interview question - what is the difference between Es5 and ES6?
JS interview question - what is the difference between Es5 and ES6?
2022-07-25 02:49:00 【H5_ ljy】
ES5 and ES6 What's the difference? ?
ES6 Some new technologies have been added :
1、let Declare variables and const declare constant , Both have block level scopes ES5 There is no block level scope in , also var There is variable Promotion , stay let in , The variables used must be declared
2、 Arrow function ES6 The function definition in no longer uses the keyword function(), It's using ()=> To define
3、 Template string Template strings are enhanced strings , Use back quotes (`) identification , It can be used as a normal string , It can also be used to define multiline strings
4、 Deconstruct assignment ES6 Allow to follow certain mode , Extract values from arrays and objects , Assign values to variables
5、for of loop for…of Loops can traverse arrays 、Set and Map structure 、 Some array like objects 、 object , And strings
6、import、export Import and export ES6 In the standard ,Js Native support module . take JS Code is divided into small pieces with different functions for modularization , Write the codes of different functions in different files , Each module only needs to export the common interface part , Then it can be used in other places by importing modules
7、set and Map Set data structure , It's like an array . All the data is unique , There are no duplicate values . It's itself a constructor ;Map Is the structure of a set of key value pairs , With extremely fast search speed . It consists of set Method to store data ,get Method to retrieve data .
8、… Extension operator You can expand the values in an array or object ; You can also collect multiple values as a variable
9、 Decorators @decorator It's a function , Used to modify the behavior of classes and even methods . Modifiers are essentially functions executed at compile time
10、class Class inheritance ES6 It's no longer like ES5 Use the prototype chain to implement inheritance , It's about introducing Class The concept
11、async、await Use async/await, collocation promise, Asynchronous processes can be handled by writing code that looks like synchronization , Improve the simplicity and readability of the code async Used to state a function It's asynchronous , and await Used to wait for an asynchronous method execution to complete
12、Promise Promise Is a solution to asynchronous programming , More than traditional solutions ( Callback functions and events ) More reasonable 、 Powerful
13、Symbol Symbol It's a basic type of .Symbol By calling symbol Function generation , It takes an optional name parameter , The function returns symbol Is the only one.
14、Proxy agent Using agents (Proxy) Listen to the operation of the object , And then you can do something about it
边栏推荐
- Pagoda workman WSS reverse proxy socket legal domain name applet chat remove port
- Jenkins configuration plug-in interface displays "suggestions collection" in Chinese
- Permanently mount the image steps
- "Introduction to interface testing" punch in day06: interface testing platform: are tools and frameworks incompatible?
- Sequence diagram of UML diagram series
- SQL Server 2022 installation
- Go common standard library -time
- Keepalivetime=0 description of ThreadPoolExecutor
- Work arrangement of generator set
- Visualization of correlation coefficient matrix
猜你喜欢

R language one page and many pictures

Is redis'module'not an internal or external command?

Details of C language compilation preprocessing and comparison of macros and functions

Wechat sports field reservation of the finished works of the applet graduation project (6) opening defense ppt

What are you working for? Don't give up is our only choice, come on, everyone

Flutter apple native Pinyin keyboard input exception on textfield | Pinyin input process callback problem

Tp5.1 login configuration method of whether to login public functions (complete login case)

C: wechat chat software instance (wpf+websocket+webapi+entityframework)

Dynamic programming -- Digital DP

Unity refers to a variable in another class (its own instance)
随机推荐
StrError and PERROR
What are the basic skills of engineers? How to practice? -- Learning experience sharing "suggestions collection"
Strategy mode, just read one article
Sword finger offer 11. rotate the minimum number of the array
On Calc optimization of calcite
[circular array] JS method collection of circular array
# CF #808 Div.2(A - C)
[system design] distributed key value database
Execution methods with static code blocks and child and parent classes
Consul cluster deployment
If there is a segment in the encryption field, are you "bronze" or "King"?
Analysis of FLV packaging
Automatic backup of Linux server PostgreSQL database
Routing policy interferes with routing
After upgrading v2.1.0, the synchronization failed
Keil compile download error: no algorithm found for: 08000000h - 08001233h solution
Pagoda workman WSS reverse proxy socket legal domain name applet chat remove port
HAC cluster is modified to stand-alone
R language one page and many pictures
How to communicate with aliens