𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 𝗪𝗵𝗶𝗹𝗲 𝗟𝗼𝗼𝗽
The while loop runs code as long as a condition is true.
JavaScript checks the condition before every turn. If the condition is true, the code runs. If the condition is false, the loop stops.
How it works:
- JavaScript checks the condition.
- The code block runs.
- The loop repeats.
Example: Use this loop to print odd numbers from 1 to 10.
Source: https://dev.to/karthick_k_983555db6df3/javascript-while-loop-17kd Optional learning community: https://t.me/GyaanSetuAi