Object.preventExtensions

Prevents the addition of new properties to an object.

Syntax

preventExtensions(object)

Parameters

Return value

The object that was passed to the function.

Examples

let obj = {}
Object.preventExtensions(obj)
obj.hello = "world" // has no effect
obj.hello
undefined