DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
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
COMMENT
Name
1+3 =
Submit