const arr = []; const obj = {}; for(let i = 0; i < 100000; i++) { arr.push({ value: i }); obj[`${i}`] = i; } const start = new Date().getTime(); let end1; arr.forEach(e => { if (e.value === 80000) { end1 = new Date().getTime(); console.log(end1-start); } }) let temp = obj['80000']; const end2 = new Date().getTime(); console.log(end2-start);