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

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -