What are the advantages of Getters and Setters

Posted by Jessica Taylor | Updated on

Below are the list of benefits of Getters and Setters,

  1. They provide simpler syntax
  2. They are used for defining computed properties, or accessors in JS.
  3. Useful to provide equivalence relation between properties and methods
  4. They can provide better data quality
  5. Useful for doing things behind the scenes with the encapsulated logic.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers