Here i need get a value from JavaScript object, if the first 8 digits of property is matched with argument.
Here is what I'm tried...
var input = { 4546546512349: {}, 7200000000007: {}, 9399543200000: {} }
function find_key(query){
$.each(input, function(k, v) {
if (k.substring(0,8) == query){
console.log(k);
return k
}
});
}
find_key(45465465);
Is there any best solution for this. Thanks in advance.