var data = [{
"name": "Peter",
"age": 30,
"hair color": "brown"
}, {
"name": "Steve",
"age": 55,
"hair color": "blonde"
}, {
"name": "Steve",
"age": 55,
"hair color": "blonde"
}]
data = this.data.filter((obj, pos, arr) => {
return arr
.map(mapObj => mapObj.name)
.indexOf(obj.name) == pos;
});
console.log(data);
/*
[{
"name": "Peter",
"age": 30,
"hair color": "brown"
}, {
"name": "Steve",
"age": 55,
"hair color": "blonde"
}]
*/
const temp = [{first: 569, second: "789", third: "458"}, {first: 476, second : "147", third: "369"}, {first: 100, second: "200", third: "300"}, {first: 100, second: "200", third: "300"}, {first: 100, second: "200", third: "300"}];
const result = [...new Set(temp.map(obj => JSON.stringify(obj)))]
.map(str => JSON.parse(str));
console.log(result);
//change is
while( $row = mysqli_fetch_array( $result ))
{
$response[] = $row;
}
//with this
while($row = mysqli_fetch_array($result))
{
$response['id'] = $row['id'];
$response['name'] = $row['name'];
$response['password'] = $row['password'];
$response['email'] = $row['email'];
}