Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to print the last element of an array

var array = [1,2,3,4,5];
var last_element = array[array.length - 1];
console.log(last_element); //Expected Output: 5
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #print #element #array
ADD COMMENT
Topic
Name
7+5 =