title: CoffeeScript function returning a function and not a value
body: <p>I have a hash that calls a function to get a value. The problem is, the function is returning the function inside rather than the values it should.</p>
  
  <p>(user is defined above this hash)</p>
  
  <p>My hash:</p>
  
  <pre><code>userInfo = {
          id: user.id,
          email: user.email,
          cars: getCars(user.id),
        }
  </code></pre>
  
  <p>Which calls this function:</p>
  
  <pre><code>  getCars = (userId) -&gt;
      id = parseInt(userId)
      userRef = new Firebase("https://demo-firebase.firebaseIO.com/users/#{id}/")
      userRef.on('value', (snapshot) -&gt;
        if snapshot.val() == null
          ["toyota"]
        else
          snapshot.val().cars # returns an array of cars
      )
  </code></pre>
  
  <p>When I'm in the debugger and stepping through the function, it returns on the <code>userRef.on</code> line rather than the correct place in the <code>if/else</code> statement.</p>
  
  <p>Here's the compiled JS:</p>
  
  <pre><code>getCars = function(userId) {
    var id, userRef;
  
    id = parseInt(userId);
    userRef = new Firebase("https://demo-firebase.firebaseIO.com/users/" + id + "/");
    return userRef.on('value', function(snapshot) {
      if (snapshot.val() === null) {
        return ["toyota"];
      } else {
        return snapshot.val().cars;
      }
    });
  };
  </code></pre>
  
  <p>Any ideas why this is happening? I'm sure it's something simple I'm overlooking.</p>