title: Closest value find from array object element using javascript
body: <p><strong>How to find user_value closest value from this array?
  Here is user_value variable according to this i need find out closest value from array.</strong> </p>
  
  <pre><code>var user_value = 5500;
  var array = [ 
  
      {_id: 5809e269d60f577ae35f6add,
        coins: 1000,
        is_active: 1,
        iconId: 4 },
      {_id: 5809e269d60f577ae35f6ade,
        coins: 2000,
        is_active: 1,
        iconId: 5 },
      {_id: 5809e269d60f577ae35f6adf,
        coins: 5000,
        is_active: 1,
        iconId: 6 },
      {_id: 5809e269d60f577ae35f6ae0,
        coins: 7000,
        is_active: 1,
        iconId: 7 },
      {_id: 5809e269d60f577ae35f6ae1,
        coins: 10000,
        is_active: 1,
        iconId: 8 },
      {_id: 5809e269d60f577ae35f6ae2,
        coins: 15000,
        is_active: 1,
        iconId: 9 } ];
  </code></pre>