Removing all unnecessary digits
for ( let j = 0 ; j < size ; j ++ ) { if ( test [ j ] . charCodeAt ( 0 ) == x + 48 || test [ j ] . charCodeAt ( 0 ) == y + 48 ) { newtest += test [ j ] ; } } if ( newtest . length > 0 ) { let size1 = newtest . length ;