I wrote this function to check how many days in my object are set to selected, but I don't like the use of the x variable. Are there ways to compact it into the forEach loop to make it more clean?
checkDaySelected() {
let x = 0;
this.componentData.days.forEach((d) => {
if (d.selected) {
x++
}
});
return x;
}