Mega Code Archive

 
Categories / JavaScript Tutorial / Array
 

Get the last element in an Array

< html> <head> <title>Get the last element in an Array</title> <script language="javascript" type="text/javascript"> <!-- var x = new Array(2,3,4); alert(x[x.length-1]); //--> </script> </head> <body> </body> </html>