JSFiddle - React, Tailwind, and code Playground

JavaScript

function ObjectB() {
    this.methodA = new function() {
        alert('a');
    };
    this.methodB = function() {
        alert('b');
    };
}

var v = Object.create(ObjectB);
v.methodA();