What is the meaning of collection in javascript
This article mainly shows you "what is the meaning of collection in javascript", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what is the meaning of collection in javascript" this article.
1. Unordered and unique data structure.
2. There is a set in ES6 called Set.
3. Common set operations, de-duplicating, judging whether an element is in the set, finding intersection and so on.
4. The set consists of a set of unordered and unique items, and the set does not repeat, that is, the elements in the set are unique.
Whether it can be understood this way, a collection is an array with neither repeating elements nor the concept of order. A collection that contains no elements is called an empty set.
Example
/ / deweighting const arr = [1 new Set 2]; const arr2 = [... new Set (arr)]; / / judging whether the element is in the set const set = new Set (arr); const has = set.has (1); / / intersection const set2 = new Set ([2Magne3]); const set3 = new Set ([... set] .filter (item = > set2.has (item) The above is all the content of this article "what is the meaning of collection in javascript?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!