So this question has been asked before, but my case is a little bit a diffrent, as I have tried all the sollution suggested in this web site, I have an multidementional array :
var array = [
{
"dup":{ "lat":36.69507771893455,"lng":2.828052824475776 },
"original":{ "lat":36.695076,"lng":2.8280580000000555}
},
{
"dup":{ "lat":36.69507687630523,"lng":2.8280525056927672},
"original":{ "lat":36.695076,"lng":2.8280580000000555}
},
{
"dup":{ "lat":36.695076,"lng":2.8280523980529324},
"original":{ "lat":36.695076,"lng":2.8280580000000555}
},
{
"dup":{ "lat":36.69507512369477,"lng":2.8280525056927672},
"original":{ "lat":36.695076,"lng":2.8280580000000555}
},
{
"dup":{ "lat":36.69507428106545,"lng":2.828052824475776},
"original":{ "lat":36.695076,"lng":2.8280580000000555}
},
{
"dup":{ "lat":36.695073504493834,"lng":2.828053342151293},
"original":{ "lat":36.695076,"lng":2.8280580000000555}
},
...
]
and I have another small array :
var datax = {"lat":36.69507428106545,"lng":2.828052824475776}
All I wanted is to find the "original" that is in the same row with this "dup". so far I tried find, filter, and grep, but none of this has solved my problem.
code that I have tried :
var Cent = $.grep(array, function(e){ return e.dup== JSON.stringify(datax); });
contentString += " and "+Cent +"is the closer";