Given the following Javascript objects, find the instructions in each file's comments and log individual values to the console using dot and bracket notation.
Last active
March 23, 2023 19:07
-
-
Save acidtone/85c2f7bfa287119033582d57d0525222 to your computer and use it in GitHub Desktop.
JS Activity: Object Value Treasure Hunt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const queenArianna = { | |
films: [ | |
"Tangled", | |
"Tangled: Before Ever After" | |
], | |
shortFilms: [ | |
"Tangled Ever After", | |
"Hare Peace" | |
], | |
tvShows: [ | |
"Once Upon a Time", | |
"Tangled: The Series" | |
], | |
videoGames: [ | |
"Disney Princess Enchanting Storybooks", | |
"Hidden Worlds", | |
"Disney Crossy Road", | |
"Kingdom Hearts III" | |
], | |
parkAttractions: [ | |
"Celebrate the Magic", | |
"Jingle Bell, Jingle BAM!" | |
], | |
allies: [], | |
enemies: [], | |
_id: 308, | |
name: "Queen Arianna", | |
imageUrl: "https://static.wikia.nocookie.net/disney/images/1/15/Arianna_Tangled.jpg", | |
url: "https://api.disneyapi.dev/characters/308" | |
} | |
// Log the following values to the console | |
// Example: Queen Arianna's name | |
console.log(queenArianna.name); | |
// 1. The ID of Queen Arianna (308) | |
// 2. An image of Queen Arianna | |
// 3. Queen Arianna's first film (Tangled) | |
// 4. Queen Arianna's last TV show (Tangled: The Series) | |
// 5. Queen Arianna's second video game (Hidden Worlds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ditto = { | |
abilities: [ | |
{ | |
ability: { | |
name: "imposter", | |
url: "https://pokeapi.co/api/v2/ability/150/" | |
}, | |
is_hidden: true, | |
slot: 3 | |
} | |
], | |
base_experience: 101, | |
forms: [ | |
{ | |
name: "ditto", | |
url: "https://pokeapi.co/api/v2/pokemon-form/132/" | |
} | |
], | |
game_indices: [ | |
{ | |
game_index: 132, | |
version: { | |
name: "white-2", | |
url: "https://pokeapi.co/api/v2/version/22/" | |
} | |
} | |
], | |
height: 3, | |
held_items: [ | |
{ | |
item: { | |
name: "metal-powder", | |
url: "https://pokeapi.co/api/v2/item/234/" | |
}, | |
version_details: [ | |
{ | |
rarity: 5, | |
version: { | |
name: "ultra-moon", | |
url: "https://pokeapi.co/api/v2/version/30/" | |
} | |
} | |
] | |
}, | |
{ | |
item: { | |
name: "quick-powder", | |
url: "https://pokeapi.co/api/v2/item/251/" | |
}, | |
version_details: [ | |
{ | |
rarity: 50, | |
version: { | |
name: "ultra-moon", | |
url: "https://pokeapi.co/api/v2/version/30/" | |
} | |
} | |
] | |
} | |
], | |
id: 132, | |
is_default: true, | |
location_area_encounters: "https://pokeapi.co/api/v2/pokemon/132/encounters", | |
moves: [ | |
{ | |
move: { | |
name: "transform", | |
url: "https://pokeapi.co/api/v2/move/144/" | |
}, | |
version_group_details: [ | |
{ | |
level_learned_at: 1, | |
move_learn_method: { | |
name: "level-up", | |
url: "https://pokeapi.co/api/v2/move-learn-method/1/" | |
}, | |
version_group: { | |
name: "scarlet-violet", | |
url: "https://pokeapi.co/api/v2/version-group/25/" | |
} | |
} | |
] | |
} | |
], | |
name: "ditto", | |
order: 214, | |
past_types: [], | |
species: { | |
name: "ditto", | |
url: "https://pokeapi.co/api/v2/pokemon-species/132/" | |
}, | |
sprites: { | |
back_default: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/132.png", | |
back_female: null, | |
back_shiny: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/back/shiny/132.png", | |
back_shiny_female: null, | |
front_default: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/132.png", | |
front_female: null, | |
front_shiny: "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/shiny/132.png", | |
front_shiny_female: null | |
}, | |
stats: [ | |
{ | |
base_stat: 48, | |
effort: 1, | |
stat: { | |
name: "hp", | |
url: "https://pokeapi.co/api/v2/stat/1/" | |
} | |
}, | |
{ | |
base_stat: 48, | |
effort: 0, | |
stat: { | |
name: "attack", | |
url: "https://pokeapi.co/api/v2/stat/2/" | |
} | |
}, | |
{ | |
base_stat: 48, | |
effort: 0, | |
stat: { | |
name: "defense", | |
url: "https://pokeapi.co/api/v2/stat/3/" | |
} | |
}, | |
{ | |
base_stat: 48, | |
effort: 0, | |
stat: { | |
name: "special-attack", | |
url: "https://pokeapi.co/api/v2/stat/4/" | |
} | |
}, | |
{ | |
base_stat: 48, | |
effort: 0, | |
stat: { | |
name: "special-defense", | |
url: "https://pokeapi.co/api/v2/stat/5/" | |
} | |
}, | |
{ | |
base_stat: 48, | |
effort: 0, | |
stat: { | |
name: "speed", | |
url: "https://pokeapi.co/api/v2/stat/6/" | |
} | |
} | |
], | |
types: [ | |
{ | |
slot: 1, | |
type: { | |
name: "normal", | |
url: "https://pokeapi.co/api/v2/type/1/" | |
} | |
} | |
], | |
weight: 40 | |
} | |
// Log the following values to the console | |
// Example: Ditto's name | |
console.log(ditto.name); | |
// 1. The `id` of Ditto (132) | |
// 2. Ditto's `base_experience` (101) | |
// 3. The `url` of Ditto's `species` | |
// 4. The url of Ditto's `front_default` in `sprites` | |
// 5. The `name` of the `version` of Ditto's first `held_items` (ultra-moon) | |
// 6. The `name` of Ditto's only `move` (transform) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment