Skip to main content
Post Closed as "Duplicate" by Andy, Zword, Marijn, Sergio, Sheridan
Formatted code
Source Link
Rémi Breton
  • 4.3k
  • 2
  • 24
  • 35

I had taken two array of objects in javascript

arr1=[arr1 = [{"name":"prudhvi", "age":"12"},
        {"name":"pavan", "age":"13"},
        {"name":"prudhvi", "age":"15"}];
arr2=[
arr2 = [{"name":"Sai", "age":"12"},
        {"name":"Shiva", "age":"13"},
        {"name":"prudhvi", "age":"12"}];
  1. Actually I want to compare both arrays based on name only. Here, name prudhvi is repeated I want to delete that object from arr2.

  2. Another thing is I want unique items in arr1. If there is any duplicate object, I want to delete it from this array.

I had taken two array of objects in javascript

arr1=[{"name":"prudhvi", "age":"12"}, {"name":"pavan", "age":"13"}, {"name":"prudhvi", "age":"15"}];
arr2=[{"name":"Sai", "age":"12"}, {"name":"Shiva", "age":"13"}, {"name":"prudhvi", "age":"12"}];
  1. Actually I want to compare both arrays based on name only. Here, name prudhvi is repeated I want to delete that object from arr2.

  2. Another thing is I want unique items in arr1. If there is any duplicate object, I want to delete it from this array.

I had taken two array of objects in javascript

arr1 = [{"name":"prudhvi", "age":"12"},
        {"name":"pavan", "age":"13"},
        {"name":"prudhvi", "age":"15"}];

arr2 = [{"name":"Sai", "age":"12"},
        {"name":"Shiva", "age":"13"},
        {"name":"prudhvi", "age":"12"}];
  1. Actually I want to compare both arrays based on name only. Here, name prudhvi is repeated I want to delete that object from arr2.

  2. Another thing is I want unique items in arr1. If there is any duplicate object, I want to delete it from this array.

I had taken two array of objects in javascript

arr1=[{"name":"prudhvi", "age":"12"},
      {"name":"pavan", "age":"13"},
      {"name":"prudhvi", "age":"15"}];
arr2=[{"name":"Sai", "age":"12"},
      {"name":"Shiva", "age":"13"},
      {"name":"prudhvi", "age":"12"}];
  1. Actually iI want to compare both arrays arrays based on name onlybased on name only. Here, name prudhvi is repeated iI want to deletedelete that object from that array2arr2.

  2. Another thing is iI want unique items in an array1 ifarr1. If there is any duplicate item is there iobject, I want to delete that objectdelete it from thethis array.

I had taken two array of objects in javascript

arr1=[{"name":"prudhvi", "age":"12"},
      {"name":"pavan", "age":"13"},
      {"name":"prudhvi", "age":"15"}];
arr2=[{"name":"Sai", "age":"12"},
      {"name":"Shiva", "age":"13"},
      {"name":"prudhvi", "age":"12"}];
  1. Actually i want to compare both arrays based on name only. Here name prudhvi is repeated i want to delete that object from that array2.

  2. Another thing is i want unique items in an array1 if any duplicate item is there i want to delete that object from the array.

I had taken two array of objects in javascript

arr1=[{"name":"prudhvi", "age":"12"}, {"name":"pavan", "age":"13"}, {"name":"prudhvi", "age":"15"}];
arr2=[{"name":"Sai", "age":"12"}, {"name":"Shiva", "age":"13"}, {"name":"prudhvi", "age":"12"}];
  1. Actually I want to compare both arrays based on name only. Here, name prudhvi is repeated I want to delete that object from arr2.

  2. Another thing is I want unique items in arr1. If there is any duplicate object, I want to delete it from this array.

corrected improved formatting
Source Link
warvariuc
  • 60k
  • 45
  • 183
  • 234

I had taken two array of objects in javascript

arr1=[{"name":"prudhvi", "age":"12"},
      {"name":"pavan", "age":"13"},
      {"name":"prudhvi", "age":"15"}];
arr2=[{"name":"Sai", "age":"12"},
      {"name":"Shiva", "age":"13"},
      {"name":"prudhvi", "age":"12"}];

1.Actually i want to compare both arrays based on name only. Here name prudhvi is repeated i want to delete that object from that array2. 2. Another thing is i want unique items in an array1 if any duplicate item is there i want to delete that object from the array.

  1. Actually i want to compare both arrays based on name only. Here name prudhvi is repeated i want to delete that object from that array2.

  2. Another thing is i want unique items in an array1 if any duplicate item is there i want to delete that object from the array.

I had taken two array of objects in javascript

arr1=[{"name":"prudhvi", "age":"12"},
      {"name":"pavan", "age":"13"},
      {"name":"prudhvi", "age":"15"}];
arr2=[{"name":"Sai", "age":"12"},
      {"name":"Shiva", "age":"13"},
      {"name":"prudhvi", "age":"12"}];

1.Actually i want to compare both arrays based on name only. Here name prudhvi is repeated i want to delete that object from that array2. 2. Another thing is i want unique items in an array1 if any duplicate item is there i want to delete that object from the array.

I had taken two array of objects in javascript

arr1=[{"name":"prudhvi", "age":"12"},
      {"name":"pavan", "age":"13"},
      {"name":"prudhvi", "age":"15"}];
arr2=[{"name":"Sai", "age":"12"},
      {"name":"Shiva", "age":"13"},
      {"name":"prudhvi", "age":"12"}];
  1. Actually i want to compare both arrays based on name only. Here name prudhvi is repeated i want to delete that object from that array2.

  2. Another thing is i want unique items in an array1 if any duplicate item is there i want to delete that object from the array.

added 9 characters in body
Source Link
Natan Streppel
  • 5.9k
  • 6
  • 39
  • 43
Loading
Source Link
Loading