Skip to content

Instantly share code, notes, and snippets.

@jslnriot
Created November 13, 2022 20:21
Show Gist options
  • Save jslnriot/a90fef093061e8bd5fedd025cf2447ea to your computer and use it in GitHub Desktop.
Save jslnriot/a90fef093061e8bd5fedd025cf2447ea to your computer and use it in GitHub Desktop.
const hashmap = new Map()
hashmap.set(1, 'first')
hashmap.set(2, 'second')
hashmap.set(3, 'third')
console.log(' full ... ', hashmap) // Map(3) { 1 => 'first', 2 => 'second', 3 => 'third' }
console.log('size ... ', hashmap.size) // returns 3
console.log('.get ... ', hashmap.get(2)) // returns second
console.log('.has ... ', hashmap.has(3)) // returns true
console.log('.has ... ', hashmap.has(4)) // returns false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment