| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Errors/Invalid_for-of_initializer | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
SyntaxError: for-of loop head declarations cannot have an initializer (Edge) SyntaxError: a declaration in the head of a for-of loop can't have an initializer (Firefox) SyntaxError: for-of loop variable declaration may not have an initializer. (Chrome)
SyntaxError
for...of . , |for (var i = 0 of iterable)| . for-of . for .
let iterable = [10, 20, 30];
for (let value = 50 of iterable) {
console.log(value);
}
// SyntaxError: a declaration in the head of a for-of loop can't
// have an initializer
for-of for-of (value = 50) . 50 .
let iterable = [10, 20, 30];
for (let value of iterable) {
value += 50;
console.log(value);
}
// 60
// 70
// 80
for...offor...in (Strict) . (SyntaxError: for-in loop head declarations may not have initializers)for .This page was last modified on 2023 8 3 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |