javascript - Remove specified element from associated array -


hi looking ways delete elements associate array. need remove values null , '' while in loop. cant because know need identify , build array store, use elements in new array seek , remove them.

var storedata3 = [   { 'key' : 'value1' },   { 'key' : 'value2' },   { 'key' : 'value3' },   { 'key' : null },   { 'key' : '' },   { 'key' : 'value10'} ]; 

try this:-

using array.filter data after omitting unwanted data.

 var result= storedata3   .filter(function(val){        return (val.key != '' && val.key != null)}); 

.filter()

fiddle


Comments

Popular posts from this blog

php - Dynamic url re-writing using htaccess -

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -