Complete the code to access the nested value using dig.
data = { user: { profile: { name: 'Alice' } } }
puts data.[1](:user, :profile, :name)The dig method allows you to safely access nested hash values by passing the keys in order.
Complete the code to safely get the city from nested data using dig.
address = { location: { city: 'Paris', country: 'France' } }
city = address.[1](:location, :city)
puts citydig safely returns the nested value or nil if any key is missing.
Fix the error in the code to correctly use dig for nested access.
profile = { info: { age: 30 } }
age = profile.[1][:info, :age]
puts ageThe dig method should be called with parentheses and keys as arguments, not with square brackets.
Fill both blanks to create a nested hash and access a value using dig.
data = { [1]: { [2]: 'Ruby' } }
puts data.dig(:language, :name)The keys :language and :name match the dig arguments to access the value 'Ruby'.
Fill all three blanks to use dig to access a deeply nested value.
config = { settings: { display: { brightness: 75 } } }
value = config.[1](:settings, [2], [3])
puts valueUse dig with keys :settings, :display, and :brightness to get the value 75.
