JS obtém certo número de elementos da matriz
const slicedArray = array.slice(0, n);
Frantic Mylo
const slicedArray = array.slice(0, n);