I am trying to update an outer variable inside angular forEach. Here is the code.
var resultMap = {};
angular.forEach(originalMap, function(value, key) {
resultMap[key] = value;
}, resultMap);
console.log(resultMap);
Do not know why resultMap is empty even after executing forEach block. Is there anything I am missign here?
Update -- For simplicity I have not mentioned the entire code here. Inside the forEach I will write some conditions to fill the resultMap.