title: Randomly select from array then assign selection to a variable
body: <p>I have a function that randomly selects a monster from an object.  Here's the function:</p>
  
  <pre><code>var travel = function(direction) {
          var newRoom = rooms[currentRoom.paths[direction]];
          if (!newRoom) {
              $("&lt;p&gt;You can't go that way.&lt;/p&gt;").properDisplay();
          }
          else {
              currentRoom = newRoom;
              $("&lt;p&gt;You are now in the " + currentRoom.name + " Room.&lt;/p&gt;").properDisplay();
                  if (currentRoom.hasMonsters) {
                      function pickRand() {
                          var monsterArray = Object.keys(monsters);   
                          var randomKey = Math.floor(Math.random() * monsterArray.length);
                          return $("&lt;p&gt;Holy Crap!  There's a " + monsterArray[randomKey] + " in here!&lt;/p&gt;").properDisplay();  
                      }
                      pickRand();
  
                  }
          }
      };
  </code></pre>
  
  <p>Here's the object:</p>
  
  <pre><code>var monsters = {
      zombie:  {
          hitPoints: 10,
          loot: "magic knife"
      },
      skeleton: {
          hitPoints: 15,
          loot: "magic shield"
      },
      ghoul:  {
          hitPoints: 12,
          loot: "magic helm"
      }
  };  
  </code></pre>
  
  <p>It's set up to randomly select "Zombie", "Skeleton", or "Ghoul."  Everything works fine.  How do I take whatever was randomly selected and save it to a variable?</p>
  
  <p>I've tried a couple things like:</p>
  
  <p><code>var beast = pickRand();</code></p>
  
  <p>and </p>
  
  <p><code>var beast = monsterArray;</code></p>
  
  <p>But no luck.  What am I missing?</p>