ECMAScript Built-ins
Native JavaScript built-in objects and methods available in SSJS — which Array, String, Math, Number, Date, RegExp, and JSON members work, which are partial, and which are missing.
SSJS runs on the JINT engine with ES3/ES5 compatibility. Most native ECMAScript built-ins work as expected, but some methods are missing or behave incorrectly. This section documents what is safe to use, and links each member to its full details and any Polyfills.
Missing methods are listed here and on each section page. For drop-in implementations, see Polyfills.
Status legend
| Icon | Meaning |
|---|---|
| ✅ Works | Available and behaves as expected |
| ⚠️ Partial | Available but with a documented caveat or bug (see Notes) |
| ❌ Missing | Not available (or undefined) — use the workaround in Notes |
Quick Reference
The ES column shows the ECMAScript edition that standardized each member (ES3, ES5, or ES6). Method names link to their full details on the relevant section page.
Array Methods
| Method | ES | Status | Notes |
|---|---|---|---|
Array.prototype.concat(...) |
ES3 | ✅ Works | |
Array.prototype.join(sep) |
ES3 | ✅ Works | |
Array.prototype.length |
ES3 | ✅ Works | |
Array.prototype.pop() |
ES3 | ✅ Works | |
Array.prototype.push(item) |
ES3 | ✅ Works | |
Array.prototype.reverse() |
ES3 | ✅ Works | |
Array.prototype.shift() |
ES3 | ✅ Works | |
Array.prototype.toLocaleString() |
ES3 | ✅ Works | |
Array.prototype.unshift(item) |
ES3 | ✅ Works | |
Array.prototype.slice(start, end) |
ES3 | ⚠️ Partial | Negative indices unreliable — see Polyfills |
Array.prototype.sort(fn) |
ES3 | ⚠️ Partial | Comparator behavior unreliable — see Polyfills |
Array.prototype.splice(start, deleteCount, ...items) |
ES3 | ⚠️ Partial | Delete form works; insert form (3rd+ arg) ignores start/deleteCount — see Polyfills |
Array.prototype.lastIndexOf(item) |
ES5 | ⚠️ Partial | Always returns -1; see Polyfills |
Array.prototype.indexOf(item) |
ES5 | ❌ Missing | See Polyfills |
Array.prototype.forEach(fn) |
ES5 | ❌ Missing | Use for loop or Polyfills |
Array.prototype.map(fn) |
ES5 | ❌ Missing | Use for loop or Polyfills |
Array.prototype.filter(fn) |
ES5 | ❌ Missing | Use for loop or Polyfills |
Array.prototype.reduce(fn) |
ES5 | ❌ Missing | Use for loop or Polyfills |
Array.prototype.reduceRight(fn) |
ES5 | ❌ Missing | Use for loop or Polyfills |
Array.prototype.some(fn) |
ES5 | ❌ Missing | Use for loop or Polyfills |
Array.prototype.every(fn) |
ES5 | ❌ Missing | Use for loop or Polyfills |
Array.prototype.find(fn) |
ES6 | ❌ Missing | Use for loop or Polyfills |
Array.prototype.findIndex(fn) |
ES6 | ❌ Missing | Use for loop or Polyfills |
Array.prototype.includes(item) |
ES6 | ❌ Missing | Use indexOf(x) !== -1 or Polyfills |
Array.prototype.fill(value) |
ES6 | ❌ Missing | See Polyfills |
Array.prototype.copyWithin(...) |
ES6 | ❌ Missing | See Polyfills |
Array.prototype.entries() |
ES6 | ❌ Missing | See Polyfills |
Array.prototype.keys() |
ES6 | ❌ Missing | Use a standard index for loop |
Array.prototype.values() |
ES6 | ❌ Missing | Use a standard index for loop |
Array.prototype.at(i) |
ES6 | ❌ Missing | Use arr[i] (and arr[arr.length + i] for negative i) |
Array.prototype.flat(depth) |
ES6 | ❌ Missing | Concatenate nested arrays manually in a loop |
Array.prototype.flatMap(fn) |
ES6 | ❌ Missing | Build the result with a for loop and push |
Array.prototype.findLast(fn) |
ES6 | ❌ Missing | Iterate from the end with a for loop |
Array.isArray(val) |
ES5 | ❌ Missing | See Polyfills |
Array.of(...) |
ES6 | ❌ Missing | See Polyfills |
Array.from(source) |
ES6 | ❌ Missing | Build the array with a for loop over the source |
String Methods
| Method | ES | Status | Notes |
|---|---|---|---|
String.prototype.charAt(i) |
ES3 | ✅ Works | |
String.prototype.charCodeAt(i) |
ES3 | ✅ Works | |
String.prototype.concat(...) |
ES3 | ✅ Works | |
String.prototype.indexOf(sub) |
ES3 | ✅ Works | |
String.prototype.lastIndexOf(sub) |
ES3 | ✅ Works | |
String.prototype.length |
ES3 | ✅ Works | |
String.prototype.localeCompare(other) |
ES3 | ✅ Works | |
String.prototype.match(regex) |
ES3 | ⚠️ Partial | No-match returns [] (empty array), not null; matches have no .index |
String.prototype.replace(search, rep) |
ES3 | ✅ Works | Regex supported |
String.prototype.slice(start, end) |
ES3 | ✅ Works | |
String.prototype.substring(start, end) |
ES3 | ✅ Works | |
String.prototype.search(regex) |
ES3 | ⚠️ Partial | Unreliable — no-match returns 0 instead of -1, and some real matches return the wrong index — see Polyfills |
String.prototype.split(sep) |
ES3 | ⚠️ Partial | Empty-separator split("") does not split into characters — see Polyfills |
String.prototype.substr(start, len) |
ES3 | ❌ Missing | Throws at runtime; use substring or the polyfill |
String.prototype.toLowerCase() |
ES3 | ✅ Works | |
String.prototype.toLocaleLowerCase() |
ES3 | ✅ Works | |
String.prototype.toUpperCase() |
ES3 | ✅ Works | |
String.fromCharCode(code) |
ES3 | ✅ Works | Static method |
String.prototype.trim() |
ES5 | ❌ Missing | See Polyfills or Platform.Function.Trim |
String.prototype.startsWith(sub) |
ES6 | ❌ Missing | Use indexOf === 0 or polyfill |
String.prototype.endsWith(sub) |
ES6 | ❌ Missing | Use lastIndexOf or polyfill |
String.prototype.includes(sub) |
ES6 | ❌ Missing | Use indexOf !== -1 |
String.prototype.trimStart() |
ES6 | ❌ Missing | Use a /^\s+/ replace |
String.prototype.trimEnd() |
ES6 | ❌ Missing | Use a /\s+$/ replace |
String.prototype.padStart(len, ch) |
ES6 | ❌ Missing | Prepend pad characters in a loop |
String.prototype.padEnd(len, ch) |
ES6 | ❌ Missing | Append pad characters in a loop |
String.prototype.repeat(n) |
ES6 | ❌ Missing | Concatenate in a loop |
String.prototype.codePointAt(i) |
ES6 | ❌ Missing | Use charCodeAt for BMP characters |
Math Object
All Math members below are ES3. Most work natively; Math.max / Math.min have argument-count caveats and Math.LOG10E is missing.
| Method / Constant | ES | Status | Notes |
|---|---|---|---|
Math.abs(x) |
ES3 | ✅ Works | |
Math.ceil(x) |
ES3 | ✅ Works | |
Math.floor(x) |
ES3 | ✅ Works | |
Math.round(x) |
ES3 | ✅ Works | |
Math.pow(base, exp) |
ES3 | ✅ Works | |
Math.sqrt(x) |
ES3 | ✅ Works | |
Math.random() |
ES3 | ✅ Works | |
Math.log(x) |
ES3 | ✅ Works | |
Math.exp(x) |
ES3 | ✅ Works | |
Math.sin/cos/tan/asin/acos/atan/atan2 |
ES3 | ✅ Works | |
Math.PI / E / LN2 / LN10 / LOG2E / SQRT2 / SQRT1_2 |
ES3 | ✅ Works | |
Math.max(a, b, ...) |
ES3 | ⚠️ Partial | Throws with 3+ args; no-arg Math.max() returns 0 not -Infinity — compare two at a time or use the polyfill |
Math.min(a, b, ...) |
ES3 | ⚠️ Partial | Throws with 3+ args; no-arg Math.min() returns 0 not +Infinity — compare two at a time or use the polyfill |
Math.LOG10E |
ES3 | ❌ Missing | undefined in SFMC; use the literal 0.4342944819032518 |
Math.trunc(x) |
ES6 | ❌ Missing | x < 0 ? Math.ceil(x) : Math.floor(x) |
Math.sign(x) |
ES6 | ❌ Missing | x > 0 ? 1 : x < 0 ? -1 : 0 |
Math.cbrt(x) |
ES6 | ❌ Missing | Math.pow(x, 1 / 3) for non-negative x |
Math.log2(x) |
ES6 | ❌ Missing | Math.log(x) / Math.LN2 |
Math.log10(x) |
ES6 | ❌ Missing | Math.log(x) / Math.LN10 |
Math.hypot(a, b) |
ES6 | ❌ Missing | Math.sqrt(a * a + b * b) |
Number
| Method / Constant | ES | Status | Notes |
|---|---|---|---|
Number.prototype.toFixed(digits) |
ES3 | ✅ Works | |
Number.prototype.toExponential([digits]) |
ES3 | ✅ Works | |
Number.prototype.toPrecision([digits]) |
ES3 | ✅ Works | |
Number.prototype.toString([radix]) |
ES3 | ✅ Works | |
Number.prototype.valueOf() |
ES3 | ✅ Works | |
Number.MAX_VALUE / MIN_VALUE / NaN / NEGATIVE_INFINITY / POSITIVE_INFINITY |
ES3 | ✅ Works | |
Number.isInteger(val) |
ES6 | ❌ Missing | Use typeof n === "number" && Math.floor(n) === n |
Number.isNaN(val) |
ES6 | ❌ Missing | Use global isNaN() |
Number.isFinite(val) |
ES6 | ❌ Missing | Use global isFinite() |
Number.parseInt(str) |
ES6 | ❌ Missing | Use global parseInt() |
Number.MAX_SAFE_INTEGER |
ES6 | ❌ Missing | undefined — use the literal 9007199254740991 |
Global Functions
Standard ECMAScript global functions (not SFMC-specific) — callable without any namespace.
| Function | ES | Status | Notes |
|---|---|---|---|
parseInt(str[, radix]) |
ES3 | ⚠️ Partial | Always pass a radix; returns NaN for trailing non-digits (parseInt("10px", 10) → NaN, not 10) |
parseFloat(str) |
ES3 | ⚠️ Partial | Returns NaN for trailing non-digits (parseFloat("1.5kg") → NaN); result uses 32-bit precision |
isNaN(val) |
ES3 | ✅ Works | |
isFinite(val) |
ES3 | ✅ Works |
Object Methods
| Method | ES | Status | Notes |
|---|---|---|---|
Object.prototype.hasOwnProperty(v) |
ES3 | ✅ Works | Use inside for...in to skip inherited properties |
Object.defineProperty(obj, prop, desc) |
ES5 | ✅ Works | Static method |
Object.getPrototypeOf(obj) |
ES5 | ⚠️ Partial | Exists but throws at runtime; see Polyfills |
Object.keys(obj) |
ES6 | ❌ Missing | Use for...in with hasOwnProperty |
Object.assign(target, ...src) |
ES6 | ❌ Missing | Copy properties manually in a for...in loop |
Object.create(proto) |
ES5 | ❌ Missing | Use a constructor function with new |
Object.freeze(obj) |
ES5 | ❌ Missing | No equivalent — enforce immutability by convention |
Object.getOwnPropertyNames(obj) |
ES5 | ❌ Missing | Use for...in with hasOwnProperty |
Function Methods
| Method | ES | Status | Notes |
|---|---|---|---|
Function.prototype.call(thisArg, ...) |
ES3 | ✅ Works | |
Function.prototype.apply(thisArg, argsArray) |
ES3 | ✅ Works | |
Function.prototype.bind(thisArg, ...) |
ES5 | ❌ Missing | Prototype is sealed — use the bindFn helper in Polyfills |
Date Methods
Value-confirmed Date members — see Date Methods for examples.
| Method | ES | Status | Notes |
|---|---|---|---|
Date.prototype.getFullYear() |
ES3 | ✅ Works | |
Date.prototype.getMonth() |
ES3 | ✅ Works | 0-based |
Date.prototype.getDate() |
ES3 | ✅ Works | |
Date.prototype.getDay() |
ES3 | ✅ Works | |
Date.prototype.getHours() |
ES3 | ✅ Works | |
Date.prototype.getMinutes() |
ES3 | ✅ Works | |
Date.prototype.getSeconds() |
ES3 | ✅ Works | |
Date.prototype.getMilliseconds() |
ES3 | ⚠️ Partial | Frequently off by one — do not rely on exact millisecond values |
Date.prototype.getTime() |
ES3 | ✅ Works | |
Date.prototype.getTimezoneOffset() |
ES3 | ✅ Works | |
Date.prototype.valueOf() |
ES3 | ✅ Works | |
Date.prototype.toString() |
ES3 | ✅ Works | |
Date.prototype.toDateString() |
ES3 | ✅ Works | |
Date.prototype.toUTCString() |
ES3 | ✅ Works | |
Date.prototype.toISOString() |
ES5 | ❌ Missing | Build the ISO string manually or use Platform.Function.FormatDate |
Date.now() |
ES5 | ✅ Works | Static |
Date.parse(str) |
ES3 | ✅ Works | Static |
Date.UTC(year[, ...]) |
ES3 | ✅ Works | Static |
RegExp
Value-confirmed RegExp members — see Regular Expressions for syntax, flags, and examples.
| Method / Property | ES | Status | Notes |
|---|---|---|---|
RegExp.prototype.test(string) |
ES3 | ✅ Works | |
RegExp.prototype.exec(string) |
ES3 | ⚠️ Partial | Full match result[0] works, but capture groups result[1]+ are undefined; lastIndex does not advance |
RegExp.prototype.source |
ES3 | ✅ Works | |
RegExp.prototype.global |
ES3 | ✅ Works | |
RegExp.prototype.lastIndex |
ES3 | ⚠️ Partial | Does not advance after exec()/test() with the g flag — use String.match(/.../g) to get all matches |
RegExp.prototype.ignoreCase |
ES3 | ❌ Missing | undefined in SFMC; track the i flag yourself |
RegExp.prototype.multiline |
ES3 | ❌ Missing | undefined in SFMC; track the m flag yourself |
JSON
The native JSON object is unavailable — see JSON for the SFMC alternatives.
| Method | ES | Status | Notes |
|---|---|---|---|
JSON.parse(text) |
ES5 | ❌ Missing | Use Platform.Function.ParseJSON |
JSON.stringify(value) |
ES5 | ❌ Missing | Use Platform.Function.Stringify or the Stringify global |
In This Section
| Page | Description |
|---|---|
| Array Methods | Safe and polyfillable array methods |
| String Methods | Safe and polyfillable string methods |
| Math | Math object reference |
| Number Methods | Number methods, constants, and global numeric functions |
| Object Methods | hasOwnProperty, defineProperty, and missing Object statics |
| Function Methods | Native call / apply and the bind (bindFn) helper |
| Date Methods | Value-confirmed Date getters, string conversions, and Date.UTC |
| Regular Expressions | RegExp test, exec, and the source / global / lastIndex accessors (ignoreCase / multiline are undefined in SFMC) |
| JSON | JSON.parse / JSON.stringify are unavailable — use Platform.Function.ParseJSON / Platform.Function.Stringify |