| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Set/forEach | [Back] [Original] |
Get to know MDN better
function logSetElements(value1, value2, set) {
console.log(`s[${value1}] = ${value2}`);
}
new Set(["foo", "bar", undefined]).forEach(logSetElements);
// : "s[foo] = foo"
// : "s[bar] = bar"
// : "s[undefined] = undefined"
forEach(callbackFn)
forEach(callbackFn, thisArg)
forEach() Set callback undefined
callback 3
Set thisArg forEach() callback this this undefined this callback this
1 forEach() callback forEach()
forEach() callback Set
Set
function logSetElements(value1, value2, set) {
console.log(`s[${value1}] = ${value2}`);
}
new Set(["foo", "bar", undefined]).forEach(logSetElements);
// Logs:
// "s[foo] = foo"
// "s[bar] = bar"
// "s[undefined] = undefined"
| ECMAScript 2027 LanguageSpecification # sec-set.prototype.foreach |
| Web Proxy Viewer | New URL | Original Page |