-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloop.js
More file actions
64 lines (59 loc) · 1.78 KB
/
loop.js
File metadata and controls
64 lines (59 loc) · 1.78 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// for লুপ array এলিমেন্ট গুলোকে এক এক করে আউটপুট দেখায়
const count = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
for (let i = 0; i < count.length; i++) {
const ele = count[i];
console.log(ele);
}
// while লুপ ভ্যারিয়েবলকে while কন্ডিশনে রেখে তার ভিতর সেই ভ্যারিয়েবলটা ইনক্রিমেন্ট হবে নাকি ডি-ক্রিমেন্ট হবে তা সেট করে দিয়ে আউটপুট দেখায়।
let num = 1;
while (num <= 10) {
num += 2;
console.log(num)
}
const obj = {
name: "shuvo",
isStudent: true,
Passionate: 'Programmer',
Job: "Soft Tech LTD.",
Salary: 15000
};
const arrObj = [{
name: "shuvo",
isStudent: true,
Passionate: 'Programmer',
Job: "Soft Tech LTD.",
Salary: 15000
},
{
name: "shuvo",
isStudent: true,
Passionate: 'Programmer',
Job: "Soft Tech LTD.",
Salary: 15000
},
{
name: "shuvo",
isStudent: true,
Passionate: 'Programmer',
Job: "Soft Tech LTD.",
Salary: 15000
},
{
name: "shuvo",
isStudent: true,
Passionate: 'Programmer',
Job: "Soft Tech LTD.",
Salary: 15000
}
]
// for of লুপ শুধু মাত্র array এর উপর লুপ চালানো হয়
for (const person of arrObj) {
console.log(person);
}
// for in লুপ শুধু মাত্র object এর উপর লুপ চালানো হয়
for (const person in obj) {
if (Object.hasOwnProperty.call(obj, person)) {
const ele = obj[person];
console.log(ele);
}
}