Set.prototype.forEach

Calls a callback function once for each key-value pair present in the Set object, in insertion order.

Syntax

forEach(callback, thisArg?)

Parameters

Remarks

forEach is useful for performing side-effects with set elements.

Examples

let s = new Set()
s.add("first").add("second")
s.forEach((value) => print(`${value}`))
first
second