Comment créer une tranche du tableau avec N éléments pris depuis le début en JavaScript

// how to create a slice of the array with n elements taken from the beginning in javascript
const take = (arr, n) => arr.slice(0, n);
console.log(take([1, 2, 3], 2)); // [1, 2]
console.log(take([1, 2, 3], 0)); // []
Chetan Nada