I have two JavaScript arrays (say newvalue
and oldvalue
).
These two arrays contain some common values. I want to delete all the values present in oldvalue
from the array newvalue
.
Example:say newvalue
has values 1,2,3,4 and oldvalue
has values 2,3 I want to delete 2,3 from newvalue
and newvalue
should have values 1,4
This has to be done in JavaScript.
consider this as new value
[
{"patentid":1,
"Geography":"china",
"type":"utility",
"Assignee":"abc"
},
{"patentid":2,
"Geography":"aus",
"type":"utility",
"Assignee":"abc"
},
{"patentid":3,
"Geography":"aus",
"type":"utility",
"Assignee":"abc"
},
{"patentid":4,
"Geography":"china",
"type":"utility",
"Assignee":"xyz"
}
]
consider this as old value
[{"patentid":3,
"Geography":"aus",
"type":"utility",
"Assignee":"abc"
},
{"patentid":4,
"Geography":"china",
"type":"utility",
"Assignee":"xyz"
}]
Now I have to remove objects with patent id 3 and 4 in newvalue