JSFiddle - React, Tailwind, and code Playground
by xxjcaxx
JavaScript
const table = document.createElement('table');
document.body.append(table);
console.log("[...testMap]");
const count = 10000;
for (let i = 0; i < count; i++) {
const item = document.createElement('tr');
item.id = i;
item.textContent = 'item'+i;
table.append(item);
}
const rows = document.querySelectorAll('tr');
const testMap = new Map();
console.log("[...testMap]");
/* rows.forEach((row, index) => {
testMap.set(row, false);
row.addEventListener('click',function clickRow(){
testMap.set(this,true);
console.log(...testMap);
console.log(index);
});
});
*/
console.log([...testMap]);