Array.prototype.count = function(fnc) { return this.reduce((total, i, index) => fnc(i, index) ? total+1 : total, 0); } Array.prototype.countUnique = function(fnc) { return this.reduce((total, i, index) => (total.indexOf(i) === -1 && fnc(i, index)) ? total.concat(i):total, []).length; } async function sleep(duration) { return new Promise((ok, ko) => setTimeout(ok, duration)); } const COLOR_RESET = '\x1B[39m'; const CLEAR_SCR = '\033[2J'; const COLOR_MAP = [ '\033[31m', '\033[32m', '\033[33m', '\033[35m', '\033[36m' ]; const chars = ['@', '!', '$', '%', '+', '=', '?', '#'];