0 points

#15 Data Structures with JS examples: Sets - Frontend Weekly - Medium


dashboard

Fri May 29 2020 16:15:49 GMT+0000 (UTC)

Posted by @newborn #javascript

difference(secondSet) {
  const differenceSet = new Set()
  const firstSetValues = this.values()
  firstSetValues.forEach(value => {
    if (!secondSet.has(value)) {
      differenceSet.add(value)
    }
  })
  return differenceSet
}
content_copy Copy

https://medium.com/front-end-weekly/15-data-structures-with-js-examples-sets-5c0c7e52203