I have an object:
var obj = {
a : 5,
b : 6,
c : 7
}
I want to set zero for all properties of an object using angular.forEach():
angular.forEach(obj, function(value, key) {
value = 0;
});
I displayed their values with console.log(), and I found that none of them are equal to zero .
but when i do
obj.a = 0;
obj.b = 0;
obj.c = 0;
Their values are zero.
Can someone explain about this?
source
share