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