title: Searching through a javascript enum
body: <p>I have the following javascript enum:</p>
  
  <pre><code>// Rooms
  var rooms = {
   1: 'First Room',
   2: 'Second Room',
   3: 'Third Room',
  };
  </code></pre>
  
  <p>I can easily get the room description as follows:</p>
  
  <pre><code>// Get Room Description
  var roomOne = 1;
  var roomdesc = rooms[roomOne];
  </code></pre>
  
  <p>How about if I have the room description 'First Room' and I want to get the room number?</p>
  
  <p>I tried:</p>
  
  <pre><code>// Get room number
  var roomIndex = rooms.indexOf('First Room');
  var roomNum = rooms[roomIndex];
  </code></pre>
  
  <p>But indexOf is undefined.  How can I get the room number by room description?</p>
  
  <p>Thanks</p>
  
  <p>PS: Forgot to mention.  I cannot change the rooms object.  It is being used in other areas already!   Also, I would like to do this without using prototype or jquery. Thanks.</p>