JSFiddle - React, Tailwind, and code Playground

HTML

<div id="foo">foo</div>
<div id="bar">bar</div>

JavaScript

var myObject = { },
    push = Array.prototype.push;

myObject.aNiceFunction = function() {
    Array.prototype.forEach.call( this, function( e ) {
        e.style.backgroundColor = 'red';
    });
};

push.call( myObject, document.getElementById('foo') );
push.call( myObject, document.getElementById('bar') );

myObject.splice = Array.prototype.splice;


console.log(myObject);
myObject.aNiceFunction();