jaisrid81
New Coder
I have a name value Pair List object as below :
var nameValuePair = [{'name': 2,'value':'GS'},{'name': 3,'value':'1.1'},{'name': 4,'value':'2.1'},{'name': 4,'value':'2.2'},{'name': 4,'value':'2.3'},{'name': 4,'value':'GS'},];
I need to iterate this list and need the below output as a NameValue Pair list:
var output : [{2,1},{3,1},{4,4}];
Basically I need a list of NameValue Pair where the name is the key and the Value is the count of occurrences of the key in that list.
PS : Needs to be achieved in Javascript
var nameValuePair = [{'name': 2,'value':'GS'},{'name': 3,'value':'1.1'},{'name': 4,'value':'2.1'},{'name': 4,'value':'2.2'},{'name': 4,'value':'2.3'},{'name': 4,'value':'GS'},];
I need to iterate this list and need the below output as a NameValue Pair list:
var output : [{2,1},{3,1},{4,4}];
Basically I need a list of NameValue Pair where the name is the key and the Value is the count of occurrences of the key in that list.
PS : Needs to be achieved in Javascript