I've searched high and low for answers to my query, but haven't found any that satisfy my needs. Perhaps I'm not using the right search terms...
I'm dealing with a set of checkboxes that can be either "on" or "off".
When these checkboxes are returned using req.query, I want to push the key/value pairs of the "on" checkboxes to an array. This array will be used later in a MongoDB query. While I know I can use Object.entries(req.query) to iterate through them, I'm curious if there's a simpler way, similar to the example below:
let checkboxCol = [];
if (checkboxa, checkboxb, checkboxc, checkboxd) {
checkboxCol.push(/* add any checkboxes that are "on" */);
}