In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces "what are the new data types in es6". In daily operation, I believe many people have doubts about the new data types in es6. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "what are the new data types in es6?" Next, please follow the editor to study!
The operating environment of this tutorial: windows7 system, ECMAScript version 6, Dell G3 computer.
New data types for ES6
Symbol type (basic)
Set type (complex)
Map type (complex)
WeakSet type (complex)
WeakMap type (complex)
TypedArray type (complex)
Let's take a look at what data types there were before es6.
Basic types:
String
Null
Undefined
Number
Boolean
Type of complexity:
Object
As the new type is basically not used in ordinary work, so the specific introduction or directly look at the professional explanation of MDN, the following to explain some questions often encountered in the interview.
Q1: how do you make an object have a private property? What is the use of Symbol? )
Answer: just use Symbol as the key of the object
{/ / Private scope let a = Symbol () window.oo = {name: 'object', age: 18, [a]: 'this is a private attribute'} console.log (oo [a]) / / this is a private property} / / it can no longer be printed out of scope.
At this point, the object oo has a private property that cannot be printed correctly outside the scope.
Q2: how to quickly repeat an array?
Answer: use Set plus Array.form ()
This is a classic interview question. Before that, let's talk about how to remove repetition before es6:
Let array = [1, 2, 3, 4, 4, 5, 5, 6] ~ function uniq () {let result = [] let hash = {} for (let item0; I
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.