This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const map = new Map() | |
| for (let i=0; i<array.length; i++) { | |
| map.set(array[i], i) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // code to create arrays with super powers ! | |
| const superArray = (initArray) => { | |
| const toPos = (index, target) => { | |
| const _index = Number(index); | |
| return index < 0 ? target.length + _index : _index; | |
| }; | |
| return new Proxy(initArray, { | |
| get(target, prop) { |