title: test cases using Jasmine for each scenario
body: <p>I am trying to write a jasmine unit test for my sorted programme..
  i am new in writing jasmine as well as test case..
  providing my code an-below below...
  can you guys tell me how to do it in  a fiddle...</p>
  
  <p><a href="http://jsfiddle.net/YYg8U/" rel="nofollow">http://jsfiddle.net/YYg8U/</a></p>
  
  <pre><code>var myNumbersToSort = [-1, 2, -3, 4, 0.3, -0.001];
  
  function getClosestToZero(numberSet) {
      var i = 0, positiveSet = [], positiveClosest = 0;
      for (i = 0; i &lt; numberSet.length; i += 1) {
          positiveSet.push(numberSet[i] &gt;= 0 ? numberSet[i] : numberSet[i] * -1);
      }
      positiveClosest = Math.min.apply(Math, positiveSet);
      return numberSet[positiveSet.indexOf(positiveClosest)];
  }
  
  alert(getClosestToZero(myNumbersToSort));
  </code></pre>