Global Values
The ECMAScript global value properties in SSJS — undefined works, NaN mostly works (lowercase string), but Infinity is severely broken (sign inverted in comparisons and string coercion), and the ES2020 globalThis is missing.
The ECMAScript global value properties have mixed support in SSJS. undefined works exactly as expected and NaN behaves correctly for comparisons (only its string form is lowercase). Infinity is severely broken in the SFMC Jint engine: its sign is inverted in both numeric comparisons and string coercion (Infinity > 0 returns false, String(Infinity) yields -infinity). The ES2020 globalThis is not defined.
Status legend
| Icon | Meaning |
|---|---|
| ✅ Works | Available and behaves as expected |
| ⚠️ Partial | Available but with a documented caveat or bug |
| ❌ Missing | Not available (or undefined) — use the workaround |
Members
| Member | ES | Status | Notes |
|---|---|---|---|
undefined |
ES3 | ✅ Works | |
NaN |
ES3 | ⚠️ Partial | String(NaN) is lowercase nan — |
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
<circle cx="6" cy="6" r="4.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M6 3.5v3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6 8.3v.2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
Pending </span>
</span>
|
| Infinity | ES3 | ⚠️ Partial | Sign inverted: Infinity > 0 is false, String(Infinity) is -infinity —
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
<circle cx="6" cy="6" r="4.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M6 3.5v3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6 8.3v.2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
Pending </span>
</span>
|
| globalThis | ES2020 | ❌ Missing | undefined — no global-object reference is exposed |
undefined
(ES3) — ✅ Works. The primitive undefined value. typeof undefined is "undefined", an unassigned declared variable is undefined, and String(undefined) is "undefined".
var x;
(typeof x === "undefined"); // true
(undefined === undefined); // true
String(undefined); // "undefined"
NaN
(ES3) — ⚠️ Partial.
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
<circle cx="6" cy="6" r="4.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M6 3.5v3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6 8.3v.2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
Pending </span>
</span>
The not-a-number value. Comparisons behave correctly — NaN === NaN is false, isNaN(NaN) is true. Only its string coercion is lowercase (nan) instead of the spec’s NaN.
(NaN === NaN); // false
isNaN(NaN); // true
String(NaN); // "nan" in SFMC (spec: "NaN")
MDN specifies String(NaN) produces "NaN"; the SFMC Jint engine produces the lowercase "nan". Comparison semantics are unaffected.
Infinity
(ES3) — ⚠️ Partial.
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
<circle cx="6" cy="6" r="4.5" stroke="currentColor" stroke-width="1.2"/>
<path d="M6 3.5v3" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
<path d="M6 8.3v.2" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"/>
</svg>
Pending </span>
</span>
The Infinity global is broken in the SFMC Jint engine. typeof Infinity is "number" and Infinity === (1/0) holds, but its sign is inverted everywhere else: Infinity > 0 returns false, Infinity < 0 returns true, and String(Infinity) yields -infinity. Symmetrically, -Infinity (and -1/0) compares as positive and stringifies to infinity. Even Infinity > 1e308 returns false. Do not rely on Infinity/-Infinity for magnitude comparisons or output — compare against a concrete large numeric literal instead.
typeof Infinity; // "number"
Infinity > 0; // false (BUG — should be true)
Infinity < 0; // true (BUG)
String(Infinity); // "-infinity" (BUG — sign inverted, lowercase)
String(-Infinity); // "infinity" (BUG)
Infinity > 1e308; // false (BUG)
MDN specifies Infinity is a positive value greater than any finite number and String(Infinity) is "Infinity". The SFMC Jint engine inverts the sign of Infinity/-Infinity in both comparison and string coercion (Infinity > 0 is false, String(Infinity) is "-infinity"), making the global unreliable for magnitude checks and output. Prefer comparing against a concrete numeric literal.
globalThis
(ES2020) — ❌ Missing. globalThis is not defined in the SFMC engine (typeof globalThis === "undefined"). There is no standard reference to the global object; top-level this is also unusable (referencing this at top scope crashes the CloudPage). Reference the specific globals (Platform, Variable, …) you need directly.
(typeof globalThis === "undefined"); // true — not available