Remove first occurence in array using jQuery -


i trying delete array first occurence, not elements searched element array like:

groupedobjects: [     { value: 125, currency: "eur" },      { value: 100, currency: "usd" },     { value: 100, currency: "usd" },      { value: 320, currency: "ron" } ] 

the code using solve problem is:

var newarr = $.grep(amount, function(item, idx) {     return item.currency == currency || item.value == val; }, true); amount = newarr; 

the problem code using it, delete occurences found, not first 1 can me?

$.each(amount, function(idx, item) {     if (item.currency == currency || item.value == val) {         amount.splice(idx, 1); // remove current item         return false; // end loop     } }); 

demo


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -