CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Breaking Out of a Loop

JavaScript code walkthrough · Question 20
easyLoops

Code

Read carefully. What does this print?
1let result = 0;
2for (let i = 0; i < 10; i++) {
3 if (i === 4) break;
4 result += i;
5}
6console.log(result);

Your answer