FCC: Using Objects for Lookups

Instructions:

Convert the switch statement below into a lookup table called lookup. Use it to lookup val and assign the associated string to the result variable.

Screen Shot 2017-01-11 at 10.16.01 PM.png

Solution: 

Screen Shot 2017-01-11 at 10.14.29 PM.png

I forgot to assign lookup[val] to result so got confused by this problem for a minute.

Advertisements
FCC: Using Objects for Lookups

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s