JavaScript Getters and Setters

JavaScript has properties with getters and setters, just like languages such as C#. They don't seem to be as widely used. If you're defining an object and want to handle events, validate input, format output, etc., then properties are a good way to make that happen. Or you could also use Java-style getX/setX methods, which accomplish the same thing with a different syntax.

View code on GitHub

Comments

Popular posts from this blog

DotNet CLI

Nullable reference types

C# Static Constructors