I want to get the values of the items then remove the keys not associated to the columns
Below is my code
var columns =['title','code','notes','value','daysCode'];
var items =[{
title:'Marvel',
code:'marvel-01',
notes:'spider-man',
value:'Value 2',
daysCode:'Sept 1, 2020',
daysAge:'Nov 1 , 2019',
name:'Peter Parker',
other:'comic'
},
{
title:'DC',
code:'dc-01',
notes:'batman',
value:'Value 1',
daysCode:'Sept 1, 2020',
daysAge:'Nov 1 , 2019',
name:'Bruce Wayne',
other:'comics'
},
{
title:'Image',
code:'image-02',
notes:'spawn',
value:'Value 3',
daysCode:'Sept 1, 2020',
daysAge:'Nov 1 , 2019',
name:'Albert Simmons',
other:'comics'
}
]
Output:
newItems = [{
title:'Marvel',
code:'marvel-01',
notes:'spider-man',
value:'Value 2',
daysCode:'Sept 1, 2020'
},
{
title:'DC',
code:'dc-01',
notes:'batman',
value:'Value 1',
daysCode:'Sept 1, 2020'
},
{
title:'Image',
code:'image-02',
notes:'spawn',
value:'Value 3',
daysCode:'Sept 1, 2020'
}]
How can I do it?