JSFiddle - React, Tailwind, and code Playground

by guyluchenbill

HTML

<input id='first' /> 
<input id='second' />

JavaScript

function assert(a,b) { console.log([a,b]); }

var elems = { 
    length: 0, 
    add: function(elem) { 
       Array.prototype.push.call(this,elem);  
    }, 
    gather: function(id) { 
       this.add(document.getElementById(id));   
    }
}; 
elems.gather('first'); 
assert(elems.length == 1 && elems[0].nodeType, 'verify element in statch'); 

elems.gather('second'); 
assert(elems.length == 2 && elems[1].nodeType, 'verify the other');