score = (x) -> if x == "Yes" 10 else 0 weights = [0.2, 0.2, 0.2, 0.2, 0.2] scope_3_ghg_emissions = [disclosure, reductions_disclosure, targets, targets_reporting, alignment] weights.reduce((weighted_sum, weight, index) -> weighted_sum + weight*score(scope_3_ghg_emissions[index]) , 0)