I require to maintain only a specific number of elements in an Javascript array. Lets say only 10 items in the array. It should follow the FIFO concept, which means if there are 10 items on the array and a new item is added, then the item[0] should automatically be popped out of the array. Is there a way to do this or should I be doing the whole stuff programatically on Javascript array?
Share
I’d probably create my own object that has an array in it:
http://jsfiddle.net/6Nevz/2/