Infinite Loop in Data Processing
★★★☆☆
📁 angular/angular 🔢
mno7890 Logic Error ★★★☆☆
Difficulty
+100 XP reward
file.js
| 1 | function processItems(items) { |
| 2 | let index = 0; |
| 3 | while (index < items.length) { • Line 3-6: Infinite loop - index never increments |
| 4 | console.log(items[index]); |
| 5 | // Missing: index++ • Missing increment statement causes endless iteration |
| 6 | } |
| 7 | return 'done'; |
| 8 | } |
Hints:
- • Line 3-6: Infinite loop - index never increments
- • Line 5: Missing increment statement causes endless iteration
Submit Your Fix
Lines marked: 0
Click a marked line number below to edit its fix.
Click on lines in the diff above to mark them, then add your fixes here.