read only karma abstract code example
Example: read only karma abstract
const object1 = {};
// param 1: object up to property that is read only
// param 2: name of read-only property as a string
// param 3: The value to assign to the read only property and its configuration
Object.defineProperty(object1, 'property1', {
value: 42,
writable: false
});
object1.property1 = 77;
// throws an error in strict mode
console.log(object1.property1);
// expected output: 42