// Create an array of numbers up to 1000 and shuffle them
const indexes = new Array(1000).fill(0).map((_, i) => i)
indexes.sort(() => Math.random() - 0.5);
// Put them in an Object and Map
const map = indexes.reduce((o, k) => {
o[k] = k
return o
}, {})
const es6Map = new Map(indexes.map(v => [v, v]))
for (let i = 0; i < 1000; i++) {
if (map[i] === 999) {
console.log('gotcha')
}
}
for (let i = 0; i < 1000; i++) {
if (es6Map.get(i) === 999) {
console.log('gotcha')
}
}