The only way I could see doing it is to add an argument in your function for the field name. You have to add it manually to each addvalue call
function addvalue(feat, field) {
if (feat == 'Yes') {
features[i++] = field;
}
}
addvalue($feature.schoolCommGardenQuarter, "schoolCommGardenQuarter");