Control Flow: Conditionals and Loops
Control flow allows you to dictate how your code executes based on certain conditions.
Conditionals:
if/else if/else
if (age >= 18) {
console.log('Adult');
} else {
console.log('Minor');
}switchstatement – alternative to multipleif-elseblocks.
Loops:
forwhiledo...while
for (let i = 0; i < 5; i++) {
console.log(i);
}break and continue can be used to control loop execution.
