Change from Array to Object

//p5.prototype._downKeys = [];
p5.prototype._downKeys = {};
//p5.prototype._downKeys = new Set();


/* Array add */
//~this._downKeys.indexOf(e.which) || this._downKeys.push(e.which);

/* Object add */
this._downKeys[e.which] = true;

/* Set add */
//this._downKeys.add(e.which);


/* Array remove */
//const idx = this._downKeys.indexOf(e.which);
//~idx && this._downKeys.splice(idx, 1);

/* Object remove */
//delete this._downKeys[e.which];
this._downKeys[e.which] = false;

/* Set remove */
//this._downKeys.delete(e.which);


/* Array check */
//return this._downKeys.indexOf(code) != -1;

/* Object check */
return this._downKeys[code];

/* Set check */
//return this._downKeys.has(code);