+ 5

How to get a last element of an array or string?

E.g: var arr = "abc" to get a letter "a" i use var a = arr[0] And how to get "c"?

26th May 2019, 7:00 AM
Darcy Dev
Darcy Dev - avatar
2 Antworten
+ 4
arr[arr.length-1]
26th May 2019, 7:09 AM
Farry
Farry - avatar
+ 1
arr="abc"; 012 arr.length==3;
26th May 2019, 7:50 AM
Solo
Solo - avatar