๐—Ÿ๐—ข๐—ข๐—ฃ๐—ฆ ๐—”๐—ก๐—— ๐—™๐—จ๐—ก๐—–๐—ง๐—œ๐—ข๐—ก๐—ฆ ๐—œ๐—ก ๐—๐—”๐—ฉ๐—”๐—ฆ๐—–๐—ฅ๐—œ๐—ฃ๐—ง

Loops repeat code for you.

Use a for loop when you know the count. If the condition is false, the loop does not run.

A while loop checks the condition first. Think of taking a bus. You check your money first. No money means no ride. The loop never starts.

A do-while loop checks the condition last. Think of an ATM. You withdraw money first. You ask if you want more after the task. You always use the machine at least once.

Functions are code blocks for one task. Stop writing the same code multiple times. Put the code in a function. Call it when you need it.

Functions provide these benefits:

JavaScript uses three function types:

Source: https://www.w3schools.com/js/js_functions.asp Optional learning community: https://dev.to/raja_b_0c9d242e2c26cf063b/loop-for-and-do-while-funtion-4629