Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


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


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.


Save Automatically?

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.


                <h2>All Restaurants</h2>
<ul id='restaurants'></ul>

<h2>Burger Joints</h2>
<ul id='burgerJoints'></ul>

<h2>Pizza Joints</h2>
<ul id='pizzaJoints'></ul>

<h2>Tex-Mex Joints</h2>
<ul id='texMexJoints'></ul>
<h2>Cheap Joints</h2>
<ul id='cheapJoints'></ul>
<h2>Moderately Priced Joints</h2>
<ul id='moderateJoints'></ul>
<h2>Expensive Joints</h2>
<ul id='expensiveJoints'></ul>


                , *:before, *:after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;

body {
  margin: 0;
  padding: 1rem;
  font-size: 16px;
  line-height: 1.4;
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;


                // restaurants array imported from

const isKeyEqualToValue = key => value => object => object[key] === value;
const isPrice   = isKeyEqualToValue('price');
const isCuisine = isKeyEqualToValue('cuisine');

const isBurger    = isCuisine('Burger');
const isPizza     = isCuisine('Pizza');
const isTexMex    = isCuisine('Tex-Mex');

const isCheap     = isPrice('Cheap');
const isModerate  = isPrice('Moderate');
const isExpensive = isPrice('Expensive');

renderList(restaurants, 'restaurants'); 
renderList(restaurants.filter(isBurger), 'burgerJoints');
renderList(restaurants.filter(isPizza), 'pizzaJoints');
renderList(restaurants.filter(isTexMex), 'texMexJoints');

renderList(restaurants.filter(isCheap), 'cheapJoints');
renderList(restaurants.filter(isModerate), 'moderateJoints');
renderList(restaurants.filter(isExpensive), 'expensiveJoints');

// simple rendering function
function renderList (restaurantList, listId) {
  const list = document.getElementById(listId);
  const listItems ={name}) => {
    const item = document.createElement('li');
    item.innerText = name;
    return item;
  listItems.forEach(listItem => {