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