I'm retrieving data from my API using Angular and adding the returned data to $scope.addresses I can get the first item in the array returned and assign it to a var firstAddress = $scope.addresses[0] how can I get the last item in the array returned?
You can do it like this:
var lastAddress = $scope.addresses[$scope.addresses.length - 1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With