javascript array show first n elements code example
Example 1: javascript select first n elements from array
const array = ['toto','tata','titi','tutu'];
array.slice(0, 2); // => ['toto','tata']
Example 2: first n elements of array js
const sliced_array = unsliced_array.slice(0, n);