This is an example of what I am trying to accomplish and as expected it is not working.
Is there something similar that would work?
var fieldsToCheck = ["a", "b", "c", "d", "e", "f"];
for (var i = 0; i < fieldsToCheck.length; i++){
var field = fieldsToCheck[counter];
if (!obj.field) {
console.log('There is no field of: ' + field);
}
}
I originally did this using only if statements for every field, I am wondering whether or not there is a faster way to do this.
obj.aequates toobj["a"]equates toprop = "a"; obj[prop]