hasOwnProperty (ES3) and Object.defineProperty (ES5) work in SSJS. Object.getPrototypeOf exists but throws. The ES5/ES6 Object statics (keys, assign, create, freeze, getOwnPropertyNames) are missing — use for...in with hasOwnProperty.

Status legend

Icon Meaning
✅ Works Available and behaves as expected
⚠️ Partial Available but with a documented caveat or bug
❌ Missing Not available — use the workaround / polyfill

Members

Member ES Status Notes
Object.prototype.hasOwnProperty(prop) ES3 ✅ Works  
Object.defineProperty(obj, prop, descriptor) ES5 ✅ Works  
Object.getPrototypeOf(obj) ES5 ⚠️ Partial Throws at runtime — see Polyfills
Object.keys(obj) ES5 ❌ Missing for...in with hasOwnProperty
Object.assign(target, ...src) ES6 ❌ Missing Copy properties in a for...in loop
Object.create(proto) ES5 ❌ Missing Use a constructor function with a prototype
Object.freeze(obj) ES5 ❌ Missing Cannot enforce immutability — read-only by convention
Object.getOwnPropertyNames(obj) ES5 ❌ Missing for...in with hasOwnProperty (enumerable own keys)

hasOwnProperty

(ES3) — ✅ Works. Returns true if the object has the property as its own (not inherited). Use it inside for...in loops to skip inherited members.

var obj = { name: "Jane", age: 30 };
for (var key in obj) {
    if (obj.hasOwnProperty(key)) {
        Write(key + ": " + obj[key] + "<br>");
    }
}

defineProperty

(ES5) — ✅ Works. Defines or modifies a property using a descriptor.

var o = {};
Object.defineProperty(o, "x", { value: 42, enumerable: true });
Write(o.x);   // 42

getPrototypeOf

(ES5) — ⚠️ Partial.

Object.getPrototypeOf exists in SFMC SSJS but throws at runtime, so it cannot be used directly. Apply the polyfill from Polyfills, or read the constructor’s prototype directly.

// Throws at runtime — do not use directly:
// var proto = Object.getPrototypeOf(obj);

// Safe alternative — read the constructor's prototype:
var proto = obj.constructor ? obj.constructor.prototype : null;

keys

(ES5) — ❌ Missing. Use a for...in loop with hasOwnProperty.

function keys(obj) {
    var result = [];
    for (var k in obj) { if (obj.hasOwnProperty(k)) { result.push(k); } }
    return result;
}

assign

(ES6) — ❌ Missing. Copy properties with a for...in loop and hasOwnProperty.

function assign(target, source) {
    for (var k in source) { if (source.hasOwnProperty(k)) { target[k] = source[k]; } }
    return target;
}

create

(ES5) — ❌ Missing. Use a constructor function with a prototype instead.

function makeWithProto(proto) {
    function F() {}
    F.prototype = proto;
    return new F();
}

freeze

(ES5) — ❌ Missing. Object.freeze is unavailable and immutability cannot be enforced; treat the object as read-only by convention.

getOwnPropertyNames

(ES5) — ❌ Missing. Use a for...in loop with hasOwnProperty (returns enumerable own keys only).

function ownNames(obj) {
    var result = [];
    for (var k in obj) { if (obj.hasOwnProperty(k)) { result.push(k); } }
    return result;
}

See Also