Im doing a simple algorithm which needs to get an object from a jquery key/value array, do some updates on it then replace the original object within the array with the updated object. How do I go about doing this?
What I have so far is the fetching of the object using grep:
var country = $.grep(contentArray, function (e) { return e.key == countrykey; });
country.value = 'Malta';
//Need to replace old 'country' object in contentArray
Thanks!
grep return an array
var country = $.grep(contentArray, function (e) { return e.key == countrykey; });
if(country && country.length == 1)
country[0].value = 'Malta';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With