Three or Four Ways to Make a Class-Like Thing in JavaScript

Assign a function to a variable. Have it take some arguments (or not) and then inside the function assign those arguments to properties. Create methods inside the function by assigning functions to this.functionName properties. Create a new instance of your class-like thing using the new keyword.

var Dog = function(name, color) {
    this.name = name;
    this.color = color;

    this.bark = function() {
        console.log("Woof! Woof!");
    };
};

var spacey = new Dog("Spacey", "Black");

Assign an empty function to a variable. Now add properties and methods to your variable by assigning them as properties of that variable’s prototype property. Create a new instance of your class-like thing using the new keyword.

var Dog = function() {};
Dog.prototype.name = "";
Dog.prototype.color = "";
Dog.prototype.bark = function() {
    console.log("Woof! Woof!");
}

var spacey = new Dog();
spacey.name = "Spacey";
spacey.color = "Black";

Use the class keyword followed by the name of the class and some braces. Inside the braces, create a constructor method that sets up your properties. Add additional methods outside the constructor but inside the class braces. None of these methods, including constructor, are prefaced with the function keyword or assigned to variables. Create a new instance of your class-like thing using the new keyword.

class Dog {
    constructor(name, color) {
        this.name = name;
        this.color = color;
    };

    bark() {
        console.log("Woof! Woof!");
    }
};

var spacey = new Dog("Spacey", "Black");

Mix and match all of the above. Just go nuts with it. Create a new instance of your class-like thing using the new keyword.

class Dog {
    constructor(name) {
        this.name = name;
        this.bark = function() {
            console.log("Woof! Woof!");
        };
    };
};

Dog.prototype.color = ""

var spacey = new Dog("Spacey");
spacey.color = "Black";