Combining Data Types Lab
Avengers, Assemble! (And Other Objects)
Learning Objectives
Combining data types
Prerequisites
JavaScript (objects, arrays)
Iron Man
Given the folowing object...
Log Iron Man's third ability
Log all of Iron Man's abilities by looping through the array
Log whether or not Iron Man appeared in
spiderManHomecoming
Wait, that's not right -- he did appear in that movie! Change the value to true without editing the object itself and log it again to verify it changed
Check if jarvis is there by calling on the
jarvisAreYouThere
function
Assembling other Avengers
Create a data structure for createCaptain
such that...
The following code logs
Captain America
The following code logs
peak human strength
The following code logs
i can do this all day
Create a data structure for blackWidow
such that...
The following code logs
Natalia Alianovna Romanova
The following code logs
Natalie Rushman
Avengers Nested
Given the following array, loop through it and log just their name.
MCU Movies
Given the following array of arrays, use two loops to loop over each inner array and list all the mcu movies.
Other Objects - Intstruments
Switching gears, let's look at some instrument data!
Given the above object...
Log all of the following:
telecaster
santa cruz
washburn
weber
Loop through all the electric guitars and log them
Add a
vocals
property to the object that includes a list of your favorite singers
Other Objects - Garmonbozia
In early 2017, digital archaeologists discovered a strangest, nonsensical combined data structure. Like in Raiders of the Lost Ark, they refused to look at it directly for fear of melting their faces off.
They called it "Garmonbozia" after the Twin Peaks substance that represents suffering. That substance is creamed corn.
Your mission is to console.log 'creamed corn' from deep within the bizarre structure:
Hungry for More? - Modeling Wakanda
Model census data for Wakanda, for example, total number of inhabitants, schools, parks, residents, and make up addresses for whatever necessary.
It's up to you how you model this data and what data structures you use, there's no 'right' answer, but try and think about what makes the most sense to you. Should it all be inside one object or split it into many objects? Try and list all the pross and cons you can think of for using one object versus creating some normalization by splitting it into many objects.
Hungry for More? - Extra
Want to do more combined datatype drills? Try out this extra lab.
If you didn't complete the object-ception lab, go back and complete it!
Practice your HTML and CSS by trying to recreate the google homepage
Try recreating the search view as well!
Sign up for CodeWars or HackerRank if you haven't already and try out some javascript challenges there!
Copyright 2018, General Assembly Space. Licensed under CC-BY-NC-SA, 4.0
Adapted from SEI-MAE
Last updated