JSFiddle - React, Tailwind, and code Playground

by Roman Joseph Rimorin

JavaScript

var apple = function (type, color){
    this.type = type;
    this.color = color;
}

apple.prototype = function(){
		return {
    	getInfo: function(){
    		return this.color + ' ' + this.type + ' apple';  
      }
    }
}();

var apple1 = new apple('mac', 'red');
console.log(apple1.getInfo());

var apple2 = new apple('mac2', 'red2');
console.log(apple2.getInfo());



console.log(apple1.getInfo());
console.log(apple2.getInfo());