js array get range

JavaScript
const array = ['a','b','c','d']
const sliced = array.slice(0, 3)
// ["a", "b", "c"]
Source

Also in JavaScript: