Programming Homework Help

Programming Homework Help. Javascript

Instructions

Your goal for this checkpoint is to get the tests to pass. To do so, you will be writing five different functions related to park and user data.

Dataset

You will be working with two different sets of data for these functions: parks and users.

Parks is an array of objects, similar to this:

const parks = [
  {
    id: 1,
    name: "Acadia",
    areaInSquareKm: 198.6,
    location: { state: "Maine" },
  },
  {
    id: 2,
    name: "Canyonlands",
    areaInSquareKm: 1366.2,
    location: { state: "Utah" },
  },
  {
    id: 3,
    name: "Zion",
    areaInSquareKm: 595.9,
    location: { state: "Utah" },
  },
];

Users is an object with a number of keys that represents each user. It looks something like this:

const users = {
  "karah.branch3": {
    visited: [2],
    wishlist: [1, 3],
  },
  "dwayne.m55": {
    visited: [2, 3],
    wishlist: [1],
  },
};
 
1. getWishlistParksForUser
This function takes in an array of parks, all users, and a username. It then returns an array of park objects related to the wishlist of the user with that username. Each number in the wishlist refers to the id of one of the parks.

2. userHasVisitedAllParksInState
This function returns a boolean that represents whether or not a user has visited all parks in the parks array from a given state.

3. userHasVisitedParkOnWishlist
This function takes in the list of users and two usernames. If the first user has visited any of the parks represented by the second user's wishlist, return true. Otherwise, return false.

4. getUsersForUserWishlist
This function returns all the usernames who have visited any park on the given user's wishlist.

Programming Homework Help

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"