Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="list">
  <h1>Sofia</h1>
  <ul id='sofiaParks'>
  </ul>
</div>

<div class="list">
  <h1>Marcus</h1>
  <ul id='marcusParks'>
  </ul>
</div> 

<div class="list">
  <h1>Jordan</h1>
  <ul id='jordanParks'>
  </ul>
</div>

<div class="list">
  <h1>Everyone</h1>
  <ul id='everyoneParks'>
  </ul>
</div>
              
            
!

CSS

              
                .list{
  float:left;
  padding-right: 7%;
  padding-left: 5%;
}

.list h1{
  text-align: center;
}
              
            
!

JS

              
                // In this project, you will use the skills honed thus far to generate lists of public parks with features that appeal to each of your friends
// Your 3 friends enjoy different sports: Sofia enjoys playing tennis, Marcus likes to play basketball, and Jordan likes play soccer.
// Since you've been taking coding for the web and are now a JSON genius, you decide to provide your friends with a personalized list of public parks in Baton Rouge that have courts for their favorite sport
// You use the data provided by Baton Rouge at https://data.brla.gov/resource/asgj-fg6t.json to identify the keys that relate to your friends' favorite sports, and generate their personalized lists according to which parks they can play their sport at
// Additionally, since you enjoy playing all of the sports your friends favor, check to see if there are any parks in which you can meet at to play all 3 of the sports together

// Present the personalized lists of parks to your friends by inserting each list of parks into an unordered HTML list on the web page, with their name in an h1 above their list

// The containers for the lists have already been coded in the HTML pane
// Create variables to access and store the 4 unordered list elements that you will update
// Implement Fetch API to access the json data at the link mentioned above
// Handle the parsed JSON data returned from the fetch in a separate function called assignParks
// In the assignParks function, iterate through each JSON object 
    // check the park's key:value pairs to see if Sofia, Marcus, or Jordan can practice their sport there
    // hint: look at the json data and identify these keys before hand
        // note that the objects don't contain the key:value pair if that park does not have the feature,
        // for example, not every object has a key:value pair for "outdoor_basketball" because not every park has an outdoor basketball court
        // therefore in your if statements, first check if the object even has a pair for the key you're looking for before checking the value for that key
        // ex: the if statement for a lighted baseball court would look like this:  if (park.baseball_lighted && park.baseball_lighted != "0") { ... }
    // note that there are different keys for courts of the same sport that are lighted or unlighted / indoor or outdoor, etc. 
    // courts that match the 3 friends sports should all be counted (aka it doesnt matter if the park's tennis court is unlit or not, indoor or outdoor, as long as there is that type of court/facility at the park)
        // Therefore make sure your if statements are all inclusive by using OR (||); the if statement for a baseball court would then be: if ((park.baseball_lighted && park.baseball_lighted != "0") || (park.baseball_unlighted && park.baseball_unlighted != "0")) {...}
    // remember to declare variables to store the content you will place in the unordered lists (think back to the rows variable in 6.5)
    // if the if statement results to true, update the variable storing the content to include the new list item (for which the html tag is <li> </li>) containing the name of the park.
    // finally, after looping through the data, use the innerHTML function to populate the unordered lists with the appropriate variables storing the content

              
            
!
999px

Console