JSFiddle - React, Tailwind, and code Playground

JavaScript

var Obj = {
    _valA:null,
    _valB:null,
    setA: function(val){
        this._valA = val;
        return this; //this is "Obj"
    },
    getA: function(){
        return this._valA;
    },
    setB: function(val){
        this._valB = val;
        return this; //this is "Obj"
    },
    getB: function(){
        return this._valB;
    },
    clearAll: function(){  //a general method
        this._valA = null;
        this._valB = null;
        return this;//this is "Obj" 
    }
};

Obj.setA("hi").setB("hi2").clearAll().setA("A").setB("B");
alert(Obj.getA() +":"+ Obj.getB()); //will alert "A:B"