title: javascript array find nearest date with current date + dayscounter
body: <p>Please hlp me i have to find nearest date from below objects, nearest date would come as compare to system date + dayscounter. </p>
  
  <p>please help it would be great help for me. here is jsFiddle link: 
  <a href="http://jsfiddle.net/g7rsp4b2/1/" rel="nofollow">http://jsfiddle.net/g7rsp4b2/1/</a></p>
  
  <pre><code>&lt;div class="component" data-datejson='{"success":{"yrdateslist":["October 10,2014","October 18,2014","October 22,2014","October 09,2014","October 21,2014","October 22,2014"],"dayscounter":"8"}}' id="onCampusDate"&gt;
  
  &lt;/div&gt;
  
  var allDates = $('.component').data('datejson'); 
  var dates = allDates.success.yrdateslist;
  var dayscounter = allDates.success.dayscounter;
  var now = new Date();
  var newDates = [];
  for (var i = 0; i &lt; dates.length; i++) {
      newDates.push(dates[i]);
  }
  
  alert(newDates);
  alert(now);
  </code></pre>