How to find user_value closet value from this array? Hear is user_value variable according to this i need find out closest value from array.
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 } ];
via Jay Jariwala
No comments:
Post a Comment