Delete array dengan javascript


let data = [
{id: 1, name: 'Lex'},
{id: 2, name: 'Clark'}
]
function doDelete(id){
data = data.filter(function(obj) {
return obj.id !== id;
});
}

Share on Google Plus

About paslah.com

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment