score = (x) -> if x == "Yes" 10 else 0 weights = [0.2, 0.2, 0.2, 0.2, 0.2] right_to_safe_environment = [commitment, impacts_identification, tracking_negative_impact, preventing_mitigating_remediating_negative_impact, commitment_to_safety] weights.reduce((weighted_sum, weight, index) -> weighted_sum + weight*score(right_to_safe_environment[index]) , 0)