Hi i am having a array like below
$scope.Selectedgroups =[183,184,24]
i need to convert to the below format
[{groupId:183},{groupId:184},{groupId:24}];
trying to convert by using for loop
var groups=[]
if($scope.Selectedgroups.length > 0){
for(i=0; i< $scope.Selectedgroups.length; i++){
groups.push({"groupId":$scope.Selectedgroups});
}
}
getting array format as below:
[{"groupId":[183,184,24]},{"groupId":[183,184,24]},{"groupId":[183,184,24]}]
any solution please
map(). Kindly check my answer