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

Sign up
Appearance settings

Commit 2fc3103

Browse files
authored
Added for-of
1 parent d124f6d commit 2fc3103

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎README.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,19 @@ var output = myTag`That ${ person } is a ${ age }`;
694694
console.log(output);
695695
// That Mike is a youngster
696696
```
697+
### `for-of` loop
698+
`for-of` is a new loop in ES6 that replaces both `for-in` and `forEach()` and supports the new iteration protocol.
699+
Use it to loop over iterable objects (Arrays, strings, Maps, Sets, etc.):
700+
```
701+
const iterable = ['a', 'b'];
702+
for (const x of iterable) {
703+
console.log(x);
704+
}
705+
706+
// Output:
707+
// a
708+
// b
709+
```
697710
### Proxy Object
698711
The Proxy object is used to define custom behavior for fundamental operations (e.g. property lookup, assignment, enumeration, function invocation, etc). The syntax is:
699712
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /