93.2k views
4 votes
You keep forgetting where all of your friends live, so you've decided to write a program to keep track of their addresses for you! Create a variable addressBook that stores the names and addresses of your friends. Given a friend's name, you should be able to lookup their address. The addressBook should be initialized with the following information: Nemo lives at: P Sherman, 42 Wallaby Way, Sydney Luna lives at: 20 Ottery Street, Devon, England Fred lives at 301 Cobblestone Way, Bedrock, CA Then change Nemo's address to be the following address: 124 Conch Street, Bikini Bottom, Pacific Ocean Then lookup the address for Nemo and print it out to make sure it's right! We wouldn't want to lose Nemo. Then we'd have to go find him.​

1 Answer

2 votes

Answer:

let addressBook = {

Nemo: "P Sherman, 42 Wallaby Way, Sydney",

Luna: "20 Ottery Street, Devon, England",

Fred: "301 Cobblestone Way, Bedrock, CA"

};

addressBook.Nemo = "124 Conch Street, Bikini Bottom, Pacific Ocean";

console.log(addressBook.Nemo); // "124 Conch Street, Bikini Bottom, Pacific Ocean"

User Venerik
by
8.3k points