Remove all type unidentified from array arr = arr.filter(function(n){ return n != undefined }); Fully clear a terminal process.stdout.write('\033c');