• Home
  • Blog
  • Ashford University Data Sets for Functions Javascript Problems

Ashford University Data Sets for Functions Javascript Problems

0 comments

I’m studying for my Javascript class and need an explanation.

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],
 },
};
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.
userHasVisitedAllParksInState(parks, users, "Utah", "dwayne.m55"); //> true
userHasVisitedAllParksInState(parks, users, "Utah", "karah.branch3"); //> false

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}