title: Comparing numbers to numbers as strings
body: <p>I was trying to figure out why my CoffeeScript code was not working:</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;a data-id="5"&gt;Click me&lt;/a&gt;
  </code></pre>
  
  <p><strong>CoffeeScript:</strong></p>
  
  <pre><code>id = $('a').attr('data-id')
  console.log id == 5
  </code></pre>
  
  <p>The problem is the number being returned from <code>attr('data-id')</code> is a string and comparing it to an actual number fails the comparison. What should I be doing differently so that I can easily compare numbers.</p>