I have this JS object ( data will be diffrent , it's just for example )
{10: 0,
30: 2.5,
365: 15,
730: 25,
1095: 35}
Key is Days and value is percentage. Now if input is between 0 to 10 days then percentage will be 0, if between 11 to 30 days then percentage will be 2.5 if between 31 to 365 days then percentage will be 15 if 1100 days then 35
here is my code
days - > input
obj_data - object
jQuery.each(obj_data, function(key, val) {
if( days <= key ){
console.log(val);
return false;
}
});
return true
here how to get value if days are greater than to 1095