JSFiddle - React, Tailwind, and code Playground

HTML

<pre id="output"></pre>

JavaScript

var foobar = {
    foobar : 'Hello World: ',
    
    foo : function (number) {
       var text = this.bar() + number + '\n';
       document.getElementById("output").appendChild(document.createTextNode(text));      
    },
    
    bar : function () {
        return this.foobar;
    }
};
    
foobar.foo(0);

[1,2,3].forEach(foobar.foo, foobar);