Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 591 Bytes

take.md

File metadata and controls

33 lines (21 loc) · 591 Bytes

arrays.take

take(array, [count=1])

Take method returns a slice of array with 'count' number of elements from the beginning

Arguments

  1. array (Array): input array
  2. [count=1] (Number): number of elements in the slice of the array

Returns

(Array): the slice of the array of length 'count'

Example

const result = arrays.take(['Amy', 'Brie', 'Cam', 'Dimitri']);
console.log(result);
> ['Amy']