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)});
Comments
Post a Comment