Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript Assigning to a new property on a non-extensible object is not allowed

'use strict';

let obj = {};
Object.preventExtensions(obj);

// Assignment to a new property on a non-extensible object
obj.newValue = 'new value'; // throws an error
 
PREVIOUS NEXT
Tagged: #javascript #Assigning #property #object #allowed
ADD COMMENT
Topic
Name
4+4 =