function pagination(pageNo, pageSize, array) { var offset = (pageNo - 1) * pageSize; return (offset + pageSize >= array.length) ? array.slice(offset, array.length) : array.slice(offset, offset + pageSize);}