subarray javascript first 10 code example
Example 1: javascript get sub array
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
var citrus = fruits.slice(1, 3);
// ["Orange", "Lemon"]
Example 2: array index javascript show only first 2 elements
array.slice(0, n);