Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

check unique object in array javascript site:stackoverflow.com

var data = [
{name:"Joe", date:'2018-07-01', amt:250 },
{name:"Mars", date:'2018-07-01', amt:250 },
{name:"Joe", date:'2018-07-02', amt:250 },
{name:"Saturn", date:'2018-07-01', amt:250 },
{name:"Joe", date:'2018-07-02', amt:250 },
{name:"Jupiter", date:'2018-07-01', amt:250 },
]
var resArr = [];
data.filter(function(item){
  var i = resArr.findIndex(x => (x.name == item.name && x.date == item.date && x.amt == item.amt));
  if(i <= -1){
        resArr.push(item);
  }
  return null;
});
console.log(resArr)
Comment

PREVIOUS NEXT
Code Example
Javascript :: onclick remove textarea value 
Javascript :: chinese icon in react native vector icons 
Javascript :: javascript create a multidimensional array 
Javascript :: find saturday with moment js 
Javascript :: search an array with regex javascript find 
Javascript :: load all icon from a folder in react 
Javascript :: remove an item from the end of an array 
Javascript :: lodash isequal 
Javascript :: query selector 
Javascript :: package.json 
Javascript :: vscode jest disable auto run 
Javascript :: javascript strings vs numbers 
Javascript :: phantomjs in angular 
Javascript :: js array reduce 
Javascript :: js !! 
Javascript :: vanilla js select by class 
Javascript :: export to excel on button click in javascript 
Javascript :: how to write a function in javascript 
Javascript :: suitescript get sublist value 
Javascript :: slice 
Javascript :: nodejs get file stats 
Javascript :: create expo project with a specific expo SDK 
Javascript :: destructuring 
Javascript :: d3.js on click event 
Javascript :: jquery get data attribute value by class 
Javascript :: using connect flash 
Javascript :: app running in expo client is slow 
Javascript :: npm install save shortcut 
Javascript :: import file in chrome extension 
Javascript :: make service singleton angular 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =