title: Searching object with recursive function in CoffeeScript
body: <p>This is my first post on StackOverflow.  Greetings!</p>
  
  <p>I am an absolute beginner programmer learning JavaScript and CoffeeScript.</p>
  
  <p>I am writing a recursive function to search through an object simply as a learning exercise.</p>
  
  <p>What I expect the function to do:</p>
  
  <ol>
  <li>Pass the function an object and an item.</li>
  <li>It returns "item found" if the item exists.</li>
  <li>It returns "item not found" if the item does not exist.</li>
  </ol>
  
  <p>What it currently does:</p>
  
  <ol>
  <li>Pass the function an object and an item.</li>
  <li>It returns "item not found" even though the item exists.</li>
  </ol>
  
  <p>Here is my CoffeeScript:</p>
  
  <pre><code>meats =
          a: "chickens"
          b: "bacons"
          c: "hams"
          d: "salamis"
          e: "beefs"
  
  meatSearch = (dict, key) -&gt;
          if dict is key
          then console.log "found #{dict.item}"
          else if dict.sub
          then meatSearch dict.sub, key
          else console.log "item not found"
  
  meatSearch meats, "b"
  </code></pre>