have two arrays one with a simple array with all the elements have integer value and another one with array of objects with an array (nested object).
need to compare both the array and remove the value which is not equilant.
let userValue = [
{
userName: 'Abby Jerin',
tiers: [
{ tier_name: 'Colorado', errors: [], tier_agent_id: '115867' },
{ tier_name: 'MidSouth', errors: [], tier_agent_id: '115897' },
null,
],
},
{
userName: 'Alvin Lu',
tiers: [
{
tier_name: 'Frisco West',
errors: ['is publish disabled'],
tier_agent_id: '111257',
},
{
tier_name: 'MidSouth',
errors: ['is publish disabled'],
tier_agent_id: '116526',
},
null,
],
},
{
userName: 'Alfie Gonzalez',
tiers: [
{
tier_name: 'Hillsboro',
errors: ['is publish disabled'],
tier_agent_id: '111481',
},
{
tier_name: 'MidSouth',
errors: ['is publish disabled'],
tier_agent_id: '116527',
},
null,
],
},
{
userName: 'Amanda Prather',
tiers: [
{ tier_name: 'South King County', errors: [], tier_agent_id: '111506' },
{ tier_name: 'Dallas', errors: [], tier_agent_id: '114530' },
{
tier_name: 'Cypress Champion Forest',
errors: [],
tier_agent_id: '114532',
},
null,
],
},
]
let checkedValue = [115867, 115897, 111506, 114530, 114532]
compare checkedValue with the tier_agent_id remove the tiers object if the tier_agent_id and checkedValue are not same
null?tier_agent_idis present in thecheckedValue?tier_agent_idthen dont return that particular object