I am working on a chat and using an array to hold the users. Here is my problem:
User1 joins and is given Index 0 in the array via push. User2 joins and is given Ind
remove array elements without facing re-indexing problem
var ind=[1,6]; //index positions of elements to remove
var arr=['a','b','c','d','e','f','g']; // actual array
var arr2 = arr.filter(function(item,index){
if(ind.indexOf(index)== -1){
return true;
}});
now arr2 is ==========>> ['a','c','d','e','f']