Creating Properties

Let's discuss how to create properties and how they are different from getters and setters.

Now, JavaScript supports C#-style properties. From the caller’s point of view, a property gives an illusion of a field but works as a method. Let’s revisit the Car class we created in the previous lesson and introduce another method that returns a value and then turns it into a property.

Get hands-on with 1200+ tech skills courses.