- Make decisions with
ifandswitch - Repeat tasks using loops
- Compare
for,while, anddo...while - Use
breakandcontinuecorrectly - Avoid common infinite-loop mistakes
BMC201 - Web Technology
2026-02-17
Lecture 14
Conditional Statements & Looping
Week 4 | Unit II: JavaScript Functions & Events
BMC201 - Web Technology
Mr. Prashant Kumar Nag, Assistant Professor
Learning Objectives
if and switchfor, while, and do...whilebreak and continue correctlyIf / Else Logic
Comparison and Logical Operators
=== for strict checks&& and ||Switch Statement
For Loop
Best when iteration count is known.
While and Do…While
while: condition firstdo...while: runs at least oncefor…of vs for…in
break and continue
continue: skip current iterationbreak: exit loop completelyCommon Loop Pitfalls
<= vs <)Questions?
Next: Lecture 15 - Objects & Scope