Skip to content
RED SAGSkills
hard20 pts · first answer countsjavascriptevent-loopperformance

Progress bar that never moves

This code updates a progress bar 100 times while processing items, but the user only sees 100% at the end. Why?

for (let i = 1; i <= 100; i++) {
  processItem(i) // 30 ms of sync work
  bar.style.width = i + "%"
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions