below code shows the output expected for code:
let x = [10, 20, 30, 40];
let y = [50, 60];
x.reverse().push(y[0,1]);
console.log(x);
// [40, 30, 20, 10, 60];
when adding “y” array it only shows one element
let x = [10, 20, 30, 40];
let y = [50, 60];
x.reverse().push(y[1,0]);
console.log(x);
// (5) [40, 30, 20, 10, 50]
x.reverse().push(y[1,0]);
// (5) [40, 30, 20, 10, 50]