-
Notifications
You must be signed in to change notification settings - Fork 3
/
forLoops.js
51 lines (41 loc) · 1.11 KB
/
forLoops.js
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
/*
Loop
- For
for ([1] [2] [3]) {
// Block Of Code
}
*/
// for (let i = 0; i < 10; i++) {
// console.log(i);
// }
let myFriends = [1, 2, "AShraf", "Sheno", 3, 4, "Alaa", 6, "Ali"];
// console.log(myFriends[0]);
// console.log(myFriends[1]);
// console.log(myFriends[2]);
// console.log(myFriends[3]);
// console.log(myFriends[4]);
for (let i = 0; i < myFriends.length; i++) {
console.log(myFriends[i]);
}
// let onlyNames = [];
// for (let i = 0; i < myFriends.length; i++) {
// if (typeof myFriends[i] === "string") {
// onlyNames.push(myFriends[i]);
// }
// }
// // console.log(onlyNames);
// let colors = ["Red", "Green", "Black"];
// let models = [2020, 2021];
// for (let i = 0; i < products.length; i++) {
// console.log("#".repeat(15));
// console.log(`# ${products[i]}`);
// console.log("#".repeat(15));
// console.log("Colors: ");
// for (let j = 0; j < colors.length; j++) {
// console.log(`- ${colors[j]}`);
// }
// console.log("Models: ");
// for (let k = 0; k < models.length; k++) {
// console.log(`- ${models[k]}`);
// }
// }