JSFiddle - React, Tailwind, and code Playground

by Pritesh Patel

JavaScript

let peopleFactory = (name,age,state)=>{
	
	this.name = name;
  this.age = age;
  this.state = state;
  
  this.printPerson = function(){
  	console.log(`${this.name},${this.age},${this.state}`);
  };

}

let person = peopleFactory("Pritesh",30,"CA");
let person2 = peopleFactory("Pritesh",30,"CA");

person.printPerson();
person2.printPerson();