JSFiddle - React, Tailwind, and code Playground

by JakobJingleheimer

JavaScript

var Foo = function( a )
{
    var myName = {
        first: a,
        last: ''
    };
    
    this.doStuff = function( b )
    {
        myName.last = b;
        return myName;
    };
}

var foo = new Foo('john');

console.log( foo.doStuff('smith') );