Prepare for the Salesforce JavaScript Developer Exam. Utilize comprehensive quizzes, flashcards, and multiple choice questions with hints and explanations. Boost your exam readiness!

Practice this question and more.


Which of the following is not an attribute of Object.defineProperty()?

  1. Configurable

  2. Stateful

  3. Enumerable

  4. Writable

The correct answer is: Stateful

The attribute that is not associated with Object.defineProperty() is "Stateful." Object.defineProperty() is a method in JavaScript that allows you to define new properties or modify existing properties of an object. The three attributes that are commonly used with this method are: - **Configurable**: This attribute specifies whether the property can be deleted from the object, and whether its attributes (excluding 'value' and 'writable') can be changed. If a property is not configurable, it cannot be removed or modified. - **Enumerable**: This attribute determines whether the property will show up during enumeration of the properties on the object, such as during a loop using for...in or Object.keys(). - **Writable**: This specifies whether the property’s value can be changed. If a property is defined as non-writable, any attempts to change its value will fail (in strict mode, it will throw an error). Since "Stateful" does not correspond to any defined property attributes available through Object.defineProperty(), it confirms that this is the correct answer.