Skip to main content
New Participant
November 10, 2017
Question

How to Return Last value of an Array?

  • November 10, 2017
  • 1 reply
  • 1153 views

I'm stuck in  a program where I nee the last value of an array.

Can Someone please tell me how to retrieve the last value of an array please?

Many thanks in advance

Dulan

This topic has been closed for replies.

1 reply

kglad
Adobe Expert
November 10, 2017

hi,

you can use lastElementF():

function lastElementF(a:Array):*{

return a[a.length-1];

}

p.s. if you also want to remove the last element, use the pop() method of arrays.

Dulan1207Author
New Participant
November 10, 2017

Thank you very much for your help.

kglad
Adobe Expert
November 10, 2017

you're welcome.