JSFiddle - React, Tailwind, and code Playground

by Xeon06

JavaScript

function List() {}
List.prototype = new Array();
List.prototype.add = List.prototype.push;
List.prototype.remove = function(o) {
    for(var i = 0; i < this.length; i++) {
        if (this[i] === o) {
            this.splice(i, 1);
            return true;
        }
    }
    return false;
};
List.prototype.clear = function() {
    while(this.length)
        this.remove(this[0]);
};