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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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.






                const _ = {};
const rooms = [
  "Billiard Room",
  "Dining Room"
const weapons = [
  "Lead Pipe",
const suspects = [
  "Mr. Green",
  "Mrs. Peacock",
  "Prof. Plum",
  "Mrs. White",
  "Miss Scarlett",
  "Col. Mustard"

/* ==========================================================================
  _.transform: Iterates over a collection, invoking the iteratee each time.
  The iteratee is invoked with four arguments: (accumulator, value, key, object).

  Definition: _.transform(object, iteratee, accumulator)


  const counts = _.transform(
      rooms: ['Billiard Room', 'Kitchen', 'Library', 'Conservatory', 'Hall', 'Dining Room'],
      weapons: ['Revolver', 'Knife', 'Lead Pipe', 'Candlestick', 'Rope', 'Wrench'],
      suspects: ['Mr. Green', 'Mrs. Peacock', 'Prof. Plum', 'Mrs. White', 'Miss Scarlet', 'Col. Mustard']
    (result, value, key) => {
      result[key] = value.length

  // => { rooms: 6, weapons: 6, suspects: 6 }

  Instructions: Implement the transform method to collect up rooms, weapons,
  and suspects we have found with our clues (and those we haven't yet)!

========================================================================== */
const gameData = [...rooms, ...weapons, ...suspects];
const cluesSoFar = {
  Revolver: true,
  Knife: true,
  "Billiard Room": true,
  "Miss Scarlett": true,
  Hall: true

_.transform = function(object, iteratee, accumulator) {
  // TODO: Write the solution here


const summary = _.transform(
  (accumulator, key) => {
    if (cluesSoFar[key]) {
    } else {
    return accumulator;
  { found: [], notFound: [] }

// We should have found 3 clues
console.log("1. We should have found 5 clues:", summary.found.length === 5);

// We should have 15 rooms, weapons, and suspects unaccounted for
  "2. We should have 13 rooms, weapons, and suspects unaccounted for:",
  summary.notFound.length === 13