Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Set object Relation with Array objects javascript

let myArray = ['value1', 'value2', 'value3']

// Use the regular Set constructor to transform an Array into a Set
let mySet = new Set(myArray)

mySet.has('value1')     // returns true

// Use the spread operator to transform a set into an Array.
console.log([...mySet]) // Will show you exactly the same Array as myArray
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #Set #object #Relation #Array #objects #javascript
ADD COMMENT
Topic
Name
3+5 =