score = (x) -> if x == "Yes" 10 else 0 weights = [0.5, 0.5] human_rights = [commitment, partner_commitment] weights.reduce((weighted_sum, weight, index) -> weighted_sum + weight*score(human_rights[index]) , 0)