whileLoops as long as the condition is true.Syntaxwhile (condition) { }DescriptionRepeats the block as long as the condition is met.ExampleLoading editor…▶ Try it yourselfExpected output0 1 2When to use?Indefinite repetition.Related commandsforeach / for← foreach / for