Highlighted brick wall with neon inscription constructor

Constructors and Properties

In JavaScript classes, we put constructors inside of them as follows…

class Animal {
        this.name = name;
    } }
let gorilla = new Animal(‘Bongo’);

The output would be “Bongo”. This syntax should be very familiar to those coming from traditional OO languages, such as C#.

Happy Coding!

Clay Hess

Share this post

Excuse Our Mess! We are currently remodeling!

We are currently in the process of redesigning our site. We appreciate your patience as some areas of our site show chipping and paint peeling. We hope to have it sparkling soon!

Skip to content