Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript take last n elements of array

const arr = ['a', 'b', 'c', 'd', 'e'];
const last3 = arr.slice(-3); // ['c', 'd', 'e']
Source by bobbyhadz.com #
 
PREVIOUS NEXT
Tagged: #javascript #elements #array
ADD COMMENT
Topic
Name
1+2 =