Open this example in the interactive library
Source code
const allowed = new Set(["admin", "editor"]);
console.log(allowed.has("editor"), allowed.has("guest"));
Sample output
true false

Read a Set membership. A self-contained example using the JavaScript runtime.
Open this example in the interactive library
const allowed = new Set(["admin", "editor"]);
console.log(allowed.has("editor"), allowed.has("guest"));
true false