Rules for using set trap

These rules shouldn't be violated when using the set trap:

  • If the target object property is a non-writable, non-configurable data property, then it will return as false--that is, you cannot change the property value
  • If the target object property is a non-configurable accessor property that has undefined as its [[Set]] attribute, then it will return as false--that is, you cannot change the property value

Get Learn ECMAScript - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.