-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
36 lines (27 loc) · 756 Bytes
/
Copy pathtest.js
File metadata and controls
36 lines (27 loc) · 756 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
32
33
34
35
36
//looping in javascript
//for loop in js
// for (let i = 1; i < 10; i++ ){
// console.log(i);
// };
//while loop in js it is looping continuously until it matches the condition = true
// let i = 0;
// while(i < 5){
// console.log(i);
// i++;
// };
//do-while loop in js it is looping at least once and then checking the condition
// let i = 0;
// do{
// console.log(i);
// i++;
// } while (i > 5);
//for iterating over iterable objects like arrays, strings, etc.
// const numbers = [10, 20, 30, 40, 50, 60]
// for (const num of numbers){
// console.log(num);
// }
//used for iterating over object properties
const person = {name: "prabit", age: 20}
for (const key in person){
console.log(`${key}: ${person[key]}`)
}