Skip to content

Instantly share code, notes, and snippets.

@MananTank
Created October 3, 2021 11:33
Show Gist options
  • Select an option

  • Save MananTank/d9f1144ccb5565c1d2ed4b5909faccdf to your computer and use it in GitHub Desktop.

Select an option

Save MananTank/d9f1144ccb5565c1d2ed4b5909faccdf to your computer and use it in GitHub Desktop.

Revisions

  1. MananTank created this gist Oct 3, 2021.
    4 changes: 4 additions & 0 deletions array-to-map.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    const map = new Map()
    for (let i=0; i<array.length; i++) {
    map.set(array[i], i)
    }