var array = [1,2,3,4,5,6], length = 2; arr = array.filter(function (el, index, arr) { var count = arr.length/length; index++; return index - count * ~~(index/count) < 1; }); alert(arr);