Is there a way of adding an object without having to declare a const?
function Car (make, color) {
this.make = make,
this.color = color,
this.greet = function () {
console.log(`The make is ${this.make} and color is ${this.color}`);
};
}
const newObject = "Toyota"
const ford = new Car("Ford", "blue")
ford.greet();``
const vauxhall = new Car("Vauxhall", "green")
vauxhall.greet();
I thought I may be able to have:
const newObject = "Toyota"
Then add Toyota in place of ford or vauxhall.