How to get the last element in an object?
Example:
$scope.sample =[
{"num" : "1",
{"num": "2",
{"num": "3"}
]
How can I get 3 and add it to 2? In short, how can I get the sum of the last 2 elements in an object?
How to get the last element in an object?
Example:
$scope.sample =[
{"num" : "1",
{"num": "2",
{"num": "3"}
]
How can I get 3 and add it to 2? In short, how can I get the sum of the last 2 elements in an object?