JSFiddle - React, Tailwind, and code Playground

by LyndseyB

JavaScript

function person(name) {
    return {
        name: name,
       	doSomething() {
        	
        }
    };	
}

const methods = Object.create(person);
methods.doSomething = () => return `hello ${this.name}`;

const person1 = person("Lyndsey");
const person2 = person("Simon");

console.log(person1);