javascript take an array element to array code example
Example 1: javascript array
const arr = [1, 2, 3];
Example 2: array index javascript show only first 2 elements
array.slice(0, n);
const arr = [1, 2, 3];
array.slice(0, n);