JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container" style="background: red; width: 100px; height; 100px">
</div>
JavaScript
'use strict';
(function(g) { // g is a global context (this passed)
if(typeof g.Array != 'undefined') {
return;
}
g.Array = function() {
// ...
};
g.Array.prototype.foo = function() {
console.log('bar');
};
})(this);
$('.container').html(this.Array);