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.

Example:

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:

WordPress.com Logo

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

Facebook photo

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

Connecting to %s