Answer the question
In order to leave comments, you need to log in
Why doesn't the ruby algorithm work?
There is an array
arr = [
{key: 1, value: some_value441},
{key: 2, value: some_value212},
{key: 3, value: some_value33},
{key: 4, value: some_value44},
]
arr.inject({}) do |previous, current|
previous.merge({current[:id] => current[:title]})
end
arr.inject({}) do |previous, current|
previous.merge({current[:id] => current[:title]})
current
end
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question