JavaScript : How to remove some item from an array ?

One way to remove some item is take his position on array and remove by this.


var users = [];
users = editPlace.favorites;
var index = users.indexOf(Meteor.user()._id);
users.splice(index, 1);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s