var arr1 = [{name:'test', lastname: 'test', gender:'f'},{name:'test1', lastname: 'test1', gender:'f'},{name:'test2', lastname: 'test2', gender:'m'}],
arr2 = [{name:'test21', lastname: 'test21', gender:'f'},{name:'test1', lastname: 'test1', gender:'f'},{name:'test2', lastname: 'test2', gender:'m'},{name:'test22', lastname: 'test22', gender:'m'}];
function arrayUnique(array) {
var a = array.concat();
for(var i=0; i<a.length; ++i) {
for(var j=i+1; j<a.length; ++j) {
if(a[i].name === a[j].name)
a.splice(j--, 1);
}
}
return a;
}
var arr3 = arrayUnique(arr1.concat(arr2));
var someArray = [{name:'test', lastname: 'test', gender:'f'},{name:'test1', lastname: 'test1', gender:'f'},{name:'test2', lastname: 'test2', gender:'m'}];
$.each(someArray, function(i){
if(someArray[i].gender === 'm') {
someArray.splice(i,1);
return false;
}
});
console.log(someArray);
someArray = [{name:'test', lastname: 'test', gender:'f'},{name:'test1', lastname: 'test1', gender:'f'},{name:'test2', lastname: 'test2', gender:'m'}];
johnRemoved = someArray
.filter(function (el) {
return el.gender !== "m";
}
);
console.log(johnRemoved);
var data = [{name:'test', lastname: 'test', gender:'f'},{name:'test1', lastname: 'test1', gender:'f'},{name:'test2', lastname: 'test2', gender:'m'}],
massiv = {name:'test1', lastname: 'test1', gender:'m'};
data.forEach(function(d, index){
if (d == massiv) {
data.splice(index, 1)
}
});
.box {
width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}