Please could someone tell me why this operation changes the value of the original array?
var today = new Date();
var max_x_domain = [today];
var one_year_after_end = max_x_domain.slice(0)[0];
one_year_after_end.setYear(one_year_after_end.getFullYear() - 1);
console.log('array after operation', max_x_domain);
And how can I make a copy of max_x_domain[1]... do I need to use a clone method as described here?
This is... a surprising feature of JavaScript.