Consider the vue.js object provided below:
FormattedData: Object
1: Object
approved: true
2: Object
approved: undefined
3: Object
approved: false
4: Object
approved: true
Seeking a more effective and concise method to loop through the approved
property of each object within the main object, returning false if any values are undefined.
Current solution in place:
checkAllApproved() {
let allApproved = false;
for(let design in this.orderInfo.FormattedData) {
if(this.orderInfo.FormattedData.hasOwnProperty(design)) {
allApproved = this.orderInfo.FormattedData[design].approved;
}
if(typeof allApproved == 'undefined') {
return false;
}
}
return true;
}