JSFiddle - React, Tailwind, and code Playground

by Researcher

JavaScript

// OOP 
//http://addyosmani.com/resources/essentialjsdesignpatterns/book/#whatisapattern
    
// A car 'class'
function Car ( model ){
  this.model = model;
  this.color = 'silver';
  this.year  = '2012';
}    
      
Car.prototype.getInfo =  function(){
    return this.model + ' ' + this.year;
}
    
var myCar = new Car('ford');
myCar.year = '2010';
console.log(myCar.getInfo());