JavaScript find last element value from an Array

if you want to find last element value from an Array using Javascript so I am explaining you how to get last value in array. let’s see example how to get last value :

<script>

var cities = ['indore', 'betul', 'bhopal', 'khargone', 'rau'];

var lastresult = cities[cities.length - 1];
	
	document.write('Last Element of array:-'+ lastresult );
	console.log(lastresult );

</script>
Last Element of array:-rau

One thought to “JavaScript find last element value from an Array”

Leave a Reply

Your email address will not be published. Required fields are marked *

13 − 8 =