Pen Settings



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


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.


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.


                <h1>Store locator</h1>
<h2>Service filters</h2>
    <ul id="filters">
      <li><input type="radio" id="all" name="filter" value="all" checked=""><label for="all">All</label></li>
      <li><input type="radio" id="restaurant" name="filter" value="restaurant"><label for="restaurant">Restaurant</label></li>
      <li><input type="radio" id="caffee" name="filter" value="caffee"><label for="caffee">Caffee</label></li>
      <li><input type="radio" id="shops" name="filter" value="shops"><label for="shops">Shops</label></li>
      <li><input type="radio" id="cinema" name="filter" value="cinema"><label for="cinema">Cinema</label></li>
      <li><input type="radio" id="arcade" name="filter" value="arcade"><label for="arcade">Arcade</label></li>

<ul id="data"></ul>


                * {
  box-sizing: border-box;

body {
  padding: 2rem;

li {
  margin-bottom: 1rem;

label {
  margin-left: 0.5rem;

ul {
  list-style: none;
  margin: 0;
  padding: 0;


                /* SAMPLE DATA */
const DATA = [
    id: "1",
    name: "Super mega mall",
    address: "Some address 1",
    city: "Super Mega City",
    services: ["restaurant", "caffee", "shops", "cinema", "arcade"]
    id: "2",
    name: "Super cool mall",
    address: "Some address 2",
    city: "Super Cool City",
    services: ["caffee", "shops", "cinema", "arcade"]
    id: "3",
    name: "Super medium mall",
    address: "Some address 3",
    city: "Super Medium City",
    services: ["caffee", "shops", "arcade"]
    id: "4",
    name: "Super small mall",
    address: "Some address 4",
    city: "Small Town",
    services: ["caffee", "shops"]
    id: "5",
    name: "Just shops mall",
    address: "Some address 5",
    city: "Really Small Town",
    services: ["shops"]
    id: "6",
    name: "Party town arcade",
    address: "Some address 6",
    city: "Some Other Town",
    services: ["caffee", "restaurants", "arcade"]

 const FILTERS = [

/* PROXY */

const isService = (prop) => FILTERS.includes(prop.toString());

const handleGet = (obj, prop) => {
  if (prop in obj) {
    return Reflect.get(obj, prop);

  if (prop === "all") {
    return obj;

  if (isService(prop)) {
    return obj.filter(({ services }) => services.includes(prop));

  return undefined;

const createStoresProxy = (stores) => {
  const proxy = new Proxy(stores, {
    get: handleGet

  return proxy;

/* INIT */

const stores = createStoresProxy(DATA);

const dataContainer = document.getElementById("data");

const filterInputs = document.querySelectorAll("#filters input");

filterInputs.forEach((input) => {
  input.addEventListener("click", handleClick);

function handleClick(e) {
  const value = e.currentTarget.value;
  const filtered = stores[value];

/* LOG DATA */

function logData(data) {
dataContainer.innerHTML = "";

  data.forEach(data => {
    const item = document.createElement("li");
    item.innerText = JSON.stringify(data)