Which of the following correctly uses a getter in a JavaScript object literal?

JavaScript Developer Medium

JavaScript Developer — Medium

Which of the following correctly uses a getter in a JavaScript object literal?

Key points

  • Getters in JavaScript object literals are defined with the 'get' keyword.
  • Getters allow you to compute property values dynamically.
  • Option A correctly defines a getter for the 'fullName' property.
  • Options B, C, and D do not follow the correct syntax for defining getters.

Ready to go further?

Related questions