const longArray = [1, 2, 3, 4, 5, 6, 7] // to show only first 4 elements const shortArray = longArray.slice(0,4) // slice(startIndex, numberOfSteps) console.log(longArray) // [1, 2, 3, 4, 5, 6, 7] console.log(shortArray) // [1, 2, 3, 4]