Sample let run =-1; let matches = -1; const otherStats=[]; arr.forEach((val)=>{ switch(Number(val)){ case 12100: run= 12100; break; case 200: matches = 200; break; default: otherStats.push(val); } });