JSFiddle - React, Tailwind, and code Playground

by MattLo

JavaScript

function entry () {
    this.title = null;
    this.info = [];
}

entry.prototype.setInfo = function (info) {
    this.info.push({name: info});
    
    return this;
};

entry.prototype.setTitle = function (title) {
    this.title = title;
    
    return this;
}

var e1 = (new entry)
    .setInfo('foo')
    .setInfo('bar')
    .setTitle('Hello World!');

console.log(e1);