title: CoffeeScript function argument
body: <p>I have a function that I want to pass an argument, market, to the function freeSample, but I can't seem to get it set as an argument. Please take a moment to look at my code and help me to understand how to get the market as an argument in the freeSample function.</p>
  
  <pre><code>(freeSample) -&gt;  
   market = $('#market')
    jQuery('#dialog-add').dialog =
     resizable: false
     height: 175
     modal: true
     buttons: -&gt;
      'This is Correct': -&gt;
        jQuery(@).dialog 'close'
      'Wrong Market': -&gt;
        market.focus()
        market.addClass 'color'
        jQuery(@).dialog 'close'
  </code></pre>
  
  <p>UPDATE: Here is the JavaScript I currently have that I am trying to convert to CoffeeScript.</p>
  
  <pre><code>function freeSample(market) 
   {
     var market = $('#market');
     jQuery("#dialog-add").dialog({
      resizable: false,
      height:175,
      modal: true,
       buttons: {
        'This is Correct': function() {
           jQuery(this).dialog('close');
       },
        'Wrong Market': function() {
          market.focus();
          market.addClass('color');
          jQuery(this).dialog('close');
       }
      }
    });
   }
  </code></pre>