Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMarie Jose Lemiere
872 PointsHello, I do not understand the challenge "Assign the value for key "UK" to a constant named ukCurrency." Thank you
Are we modifying the key value pair for UK ? I do not understand. Thank you
let currencies = [ "US": "Dollar", "UK": "Pound", "JP": "Yen" ]
Marie Jose Lemiere
872 PointsThank You I did : let ukCurrency = ["UK"] I also did : let ukCurrency = ["UK":"Pound"] but it still doesn't work. What did I miss ?
Roberto Alicata
Courses Plus Student 39,959 PointsYou need to read the value from the dictionary. To do it you must write the key you know ("UK" in this case):
currencies["UK"]
then if you want to store the value in a constant (or a variable) ....
let ukCurrency = currencies["UK"]
2 Answers
beven nyamande
9,575 Pointslet ukCurrencies = currencies[key] // you should figure it out
// to reference values from a dictionary you use the key i.e x['b'] = 'hello world'
beven nyamande
9,575 Pointsremember to mark best answer :)
Marie Jose Lemiere
872 PointsThank you, it works now :)
Roberto Alicata
Courses Plus Student 39,959 PointsRoberto Alicata
Courses Plus Student 39,959 PointsYou have to define a new constant named ukCurrency then you must assign the value for the key "UK" to the constant you just created
let ukCurrency = ...........