elements= [
{ "id": 0, "name": "name1", "age": 12, "city": "cityA" },
{ "id": 1, "name": "name2", "age": 7, "city": "cityC" },
{ "id": 2, "name": "name3", "age": 23, "city": "cityB" },
{ "id": 2, "name": "name1", "age": 12, "city": "cityA" }
];
I want to find elements with identical name and age. How can I achieve this?
I have attempted the following but it is returning all elements in the array:
data.some(d => {
for (const it of form) {
if (it.name == d.name && it.age == d.age) {
arr.push(it)....