I have an object called data some of the elements are undefined, or simply missing.
How can I do a for loop to assign my personal value to these fields?
data.forEach(function(obj) {
for(var i in obj) {
if(obj[i] === undefined) {
obj[i] = '';
}
}
});
This is currently only replacing the undefined, how can I update to pass an empty value for any field if it doesn't exist?