Let\'s say I have an array with data elements, in this example numbers, like this:
var a = [432, 238, 122, 883, 983];
And I want to limit t
You can check the length of array when adding and Shift it (remove the first element) if the length has passed:
function add(x) { a.push(x); if (a.length > 7) a.shift(); }