Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 345f0e5

Browse filesBrowse files
committed
Add loop examples and syntax explanation in script.js
1 parent 4fdd710 commit 345f0e5
Copy full SHA for 345f0e5

File tree

Expand file treeCollapse file tree

2 files changed

+31
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+31
-1
lines changed

‎Loops & Strings/index.html

Copy file name to clipboardExpand all lines: Loops & Strings/index.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</head>
88
<body>
99

10-
10+
1111

1212
<script src="script.js"></script>
1313
</body>

‎Loops & Strings/script.js

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//Loops
2+
3+
//Loops are a way to repeat the same code multiple times.
4+
// There are several types of loops in JavaScript, but the most common one is the for loop.
5+
6+
//1. For loop
7+
//2. While loop
8+
//3. Do while loop
9+
10+
11+
//4. For in loop
12+
//5. For of loop
13+
//6. For each loop
14+
15+
16+
//1. For loop:
17+
18+
//Syntax:
19+
20+
// for (initialization; condition; increment/decrement) {
21+
// code to be executed
22+
// }
23+
24+
//Example:
25+
26+
for (let i = 0; i < 5; i++) {
27+
console.log(i);
28+
}
29+
//Output: 0 1 2 3 4
30+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.