Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript Assigning to a getter-only property is not allowed

'use strict';

let obj2 = { get x() { return 17; } };

// assignment to a getter-only property
obj2.x = 5; // throws an error
 
PREVIOUS NEXT
Tagged: #javascript #Assigning #property #allowed
ADD COMMENT
Topic
Name
4+5 =