Code to go logo
Created using Figma
Use Cases
Contribute
How to get last array element in JavaScript
Arrays
By Jad Joubran ยท
Last updated Feb 28, 2024
const
apps
=
[
"phone"
,
"calculator"
,
"clock"
]
;
apps
.
at
(
-
1
)
;
"clock"
Feb 28, 2024
1
Jad Joubran
See answer
1
Jad Joubran
String.at()
on Learn JavaScript Blog
Learn JavaScript step by step
Related use cases
How to get last character of string in JavaScript