Skip to content
Advertisement

how to print everything from a dictionary?

I’m trying to do this question for class that is really confusing me, I can’t seem to figure it out. They give me this code and say that I need to do something to make it print all of the flowers in the dictionary instead of printing just one. Here is the code that is provided, which just prints one of the flowers.

JavaScript

Advertisement

Answer

This should work:

JavaScript

Output:

JavaScript

All I did was move your return statement out of your for loop.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement