var columnNames = [{columnName: 'User', id:'userName' }, {columnName: 'Email Id', id:'emailId' }]
var tableData = [{userName: 'aaa', emailId: 'aaa@test.com', age: 20, middleName: 'test' }, {userName: 'bbb', emailId: 'bbb@test.com', age: 30, middleName: 'test1'}, {userName: 'ccc', emailId: 'ccc@test.com', age: 40, middleName: 'test3'}];
My requirement:
var output = [{userName: 'aaa', emailId: 'aaa@test.com'}, {userName: 'bbb', emailId: 'bbb@test.com'}, {userName: 'ccc', emailId: 'ccc@test.com'}]
All I am trying to implement this but don't find a proper idea to implement this. I am completely stuck to implement this functionality. I need array of objects having all property values available in columnNames id values.