QUESTION IMAGE
Question
1.12.2 while loops in karel quiz question: 1 why do we use while loops in javascript? to break out of some block of code to do something if a condition is true to repeat some code while a condition is true to repeat something for a fixed number of times
In JavaScript, a while loop is a control - flow statement that repeats a block of code as long as a specified condition evaluates to true. It's not for breaking out of code (that's break statement), not just for doing something once when a condition is true (that's if statement), and not for a fixed number of repetitions (that's for loop in many cases).
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
C. To repeat some code while a condition is true