Ruby - Methods
You want to write a method that accepts any number of arguments and returns a hash where keys are the arguments and values are their types as strings. Which method correctly does this?
map to create pairs and then to_h converts to a hash.each which returns original array, not hash. def types_hash(*args)
args.collect { |a| a.class }
end returns array of classes, not a hash.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions