The ES6 keyed collections are not available in SSJS. The SFMC server-side JavaScript engine (Jint) implements an ES3/ES5-era dialect and predates ES2015, so Map, Set, WeakMap, and WeakSet are entirely absent. Each is undefined, and new Map() (etc.) throws Unknown type: Map.

Status legend

Icon Meaning
❌ Missing Not available (typeof is "undefined"; new throws Unknown type)

Members

Member ES Status Notes
Map ES6 ❌ Missing Use a plain object as a string-keyed dictionary
Set ES6 ❌ Missing Use a plain object whose keys are the members
WeakMap ES6 ❌ Missing No weak-reference collections exist
WeakSet ES6 ❌ Missing No weak-reference collections exist

Map

(ES6) — ❌ Missing. Map is not definedtypeof Map === "undefined" and new Map() throws Unknown type: Map.

For string-keyed lookups, use a plain object as a dictionary:

// Instead of: var m = new Map(); m.set("a", 1);
var m = {};
m["a"] = 1;
Write(m["a"]);              // 1
Write("a" in m ? "has" : "no"); // note: the `in` operator is unsafe in CloudPages —
// prefer: (typeof m["a"] != "undefined")

Object keys are always coerced to strings, so a plain object cannot key by object identity or preserve insertion order the way a real Map does.

Set

(ES6) — ❌ Missing. Set is not definedtypeof Set === "undefined" and new Set() throws Unknown type: Set.

Emulate a set of strings with a plain object whose keys are the members:

// Instead of: var s = new Set(); s.add("x");
var s = {};
s["x"] = true;
Write(typeof s["x"] != "undefined" ? "member" : "absent"); // "member"

WeakMap

(ES6) — ❌ Missing. WeakMap is not definedtypeof WeakMap === "undefined" and new WeakMap() throws Unknown type: WeakMap. There is no weak-reference mechanism in this engine; use a plain object dictionary (which holds strong references) and delete keys manually when done.

WeakSet

(ES6) — ❌ Missing. WeakSet is not definedtypeof WeakSet === "undefined" and new WeakSet() throws Unknown type: WeakSet. As with WeakMap, no weak-reference collection is available.

See Also