y, element) {
    const ndx = array.indexOf(element);
    if (ndx >= 0) {
      array.splice(ndx, 1);
    }
  }

  class SafeArray {
    constructor() {
      this.array = [];
      this.addQueue = [];
      this.removeQueue = new Set();
    }
    get isEmpty() {
      return this.addQueue.length + this.array.length > 0;
    }
    add(element) {
      this.addQueue.push(element);
    }
    remove(element) {
      this.removeQueue.add(element);
    }
    forEach(fn) {
      this._addQueued();
      this._rem