-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfor_loop.js
More file actions
31 lines (24 loc) · 747 Bytes
/
Copy pathfor_loop.js
File metadata and controls
31 lines (24 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
console.log("1 ---- 10 :");
for(let a = 1; a <= 10; a++)
{
console.log(a , " ");
}
console.log("============");
console.log("10 ---- 1 :");
for (let b = 10; b >= 1; b--)
{
console.log(b , " ");
}
/*
Lecture # 25
Topic : Loop and => for Loop in JavaScript
LOOP :- A way to repeat a block of code multiple times until a condition is met.
1. for LOOP : Used when you know how many times to run the loop.
let a = 2; a < 10; a++/ a--
SYNTAX : for (initialization; condition; update ) {
code to run
}
initialization → start value (runs once)
condition → check before each loop
update → change value after each loop
*/