Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add: Add JS Loop #182

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
for-of-loop
  • Loading branch information
thepravin committed Jan 18, 2024
commit d3acd1a0409b9f410b8dbf0695cbb2f6ba7a0306
25 changes: 25 additions & 0 deletions JsLoops/for-of-loop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# JavaScript for...of Loop README

## Description

The `for...of` loop in JavaScript is used to iterate over iterable objects, such as arrays, strings, maps, sets, and more. It provides a concise and readable syntax for iterating through the elements of a collection.

## Syntax

```javascript
for (variable of iterable) {
// code to be executed
}
```
``` variable: ``` A variable to represent the current element of the iterable in each iteration. <br/>
``` iterable: ``` The object or array-like structure to be iterated over.
### Example
#### Iterating over an Array
```javascript
const numbers = [1, 2, 3, 4, 5];

for (const number of numbers) {
console.log(number);
}

```