I want to add validation for following java script associative array.
Here is my array structure
array = [
{ id: 1, remaining_amount: 30, total: 20 },
{ id: 1, remaining_amount: 30, total: 20 },
{ id: 2, remaining_amount: 50, total: 40 }
]
From the above array, for id 1, remaining amount is 30 but total amount is 40
So i want to add the validation that if total amount is grater then remaining amount for particular id then it will show me message.
Any Idea?
remaining_amountwill always be the same on all array elements with the sameid?