arr.filter(num => num % 2)
public static void main(String[] args) {
int[] xr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
for (int i = 0; i < xr.length; i++) {
System.out.println(xr[i] % 2 == 0 ? xr[i] + " -> even" : xr[i] + " -> odd");
}
}
const evenNumbers = (array, number) => array.filter(item => item % 2 === 0).slice(-number);