MDN self-hosted library · e01.org

Iterator.prototype.forEach()

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
new Set([1, 2, 3]).values().forEach((v) => console.log(v));

// Logs:
// 1
// 2
// 3
js
for (const v of new Set([1, 2, 3]).values()) {
  console.log(v);
}