Skip to content

Instantly share code, notes, and snippets.

@mateusmarquezini
Created February 2, 2019 12:47
Show Gist options
  • Save mateusmarquezini/d995438333a63ac1ea4b10429c3884a3 to your computer and use it in GitHub Desktop.
Save mateusmarquezini/d995438333a63ac1ea4b10429c3884a3 to your computer and use it in GitHub Desktop.
let weakSet = new WeakSet()
let objeto1 = {}
let objeto2 = {}
let objeto3 = {}
// método add()
weakSet.add(objeto1)
weakSet.add(objeto2)
weakSet.add(objeto3)
// método delete()
weakSet.delete(objeto1)
// método has()
console.log(weakSet.has(objeto1)) // false
console.log(weakSet.has(objeto2)) // true
console.log(weakSet.has(objeto3)) // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment