let channels_history = [0, 0, 1, 0];
let channel = 0;
// wrapped in some button click event handler >>>>>
channel = channels_history.pop();
console.log(channels_history);
\<<<<<
which outputs
[0, 0, 1, 0]
However, if I do
console.log(channels_history.pop());
it works, and I get the desired values.