Javascript - Checking if a number is closer to 2 variables
<p>I have 12 different numbers stored in variables, like this:</p>

<pre><code>var span1 = 8.333333333;
var span2 = 16.66666667;
var span3 = 25;
var span4 = 33.33333333;
var span5 = 41.66666667;
var span6 = 50;
var span7 = 58.33333333;
var span8 = 66.66666667;
var span9 = 75;
var span10 = 83.33333333;
var span11 = 91.66666667;
var span12 = 100;
</code></pre>

<p>I have a function which compares a div's width to its parent's width and returns a value as a percentage (minus the % sign), for example, <code>48.5586</code>. I'd like the function to check which of these span variables the result is closest to. For example, <code>48.5586</code> would return <code>"span6"</code> as it's closer to 50 than 41.666667.</p>

<p>Don't really know where to start with this one, any ideas?</p>
