+ 4
about getters and setters
What exactly do the getters and setters do in JavaScript? Can someone please answer me in brief .
5 ответов
+ 7
Hello, Shivam Mirje !
"Getter" - allows you to get values (read values).
"Setter" - write values to a variable.
In the code they are the usual methods.
But the method name always starts with the prefix get or set.
+ 2
A good reference source-
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
+ 2
Getters allow you to get the value, but you can add other code to it.
Setters allow you to set the value, and you can add other code to it.
Hope it helps!😉
+ 1
Thank you all for your answers. They helped me a lot. :)