JSFiddle - React, Tailwind, and code Playground

by Ming Huang

JavaScript

var carFactory = function(wheels,brand,engines){
	var temp = {}
  temp.wheels = wheels;
  temp.brand = brand;
  temp.engines = engines;
  
  temp.drive = function(){
  	console.log(`It is driving with ${wheels} wheels`);
  }
  
  return temp;
}

let myCar = carFactory(4,'Mazda',4);

myCar.drive();

console.log(myCar.__proto__)