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