Ruby - Enumerable and Collection Processing
Which of the following correctly sorts an array
employees of hashes by the :salary key using sort_by?employees of hashes by the :salary key using sort_by?e[:salary].e[:salary]. employees.sort_by(&:salary) uses method syntax invalid for hashes. employees.sort_by { |e| e.salary } uses dot notation invalid for hashes. employees.sort_by { |e| e[:salary].to_s } converts salary to string, which changes sorting behavior.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions