I have an object and I am iterating through it's properties in order to change them (I want to replace 'a.1'-kind to 'a[1]'-kind):
.fail(function (data) {
var errors = data.responseJSON;
console.log("Object before: ", errors);
console.log("Changed properties:")
for (var property in errors) {
if (errors.hasOwnProperty(property)) {
if (property.includes('.')) {
property = property.replace(/\./, "[");
property = property.replace(/$/, "]");
console.log(property);
}
}
}
console.log("Object after: ", errors);
The properties change during iteration, but object's properties don't change for real:
How do I changed object's properties not only while iterating through them, but "forever"?:)
Appreciate any help:)
