JSFiddle - React, Tailwind, and code Playground
by duncan_m
JavaScript
var Car = function(thevendor, themodel, theyear) {
return {
vendor: thevendor,
model: themodel,
year: theyear,
name: function() {
return this.vendor + " " + this.model + " " + this.year;
},
};
return this;
};
var foo = new Car("Toyota","Corola",2007);
alert(foo.name()); //alerts "Toyota Corola 2007"
foo.vendor = "Mitubishi";
alert(foo.name());