My task involves filtering arrays of objects based on input field values. Data
data: [{
taskname: 'Test1',
taskId: '1',
status: 'Submitted'
}, {
taskname: 'Test2',
taskId: '2',
status: 'Resolved'
}, {
taskname: 'Test3',
taskId: '4',
status: 'Submitted'
}, {
taskname: 'Test4',
taskId: '5',
status: 'In Progress'
}, {
taskname: 'Test5',
taskId: '6',
status: 'Resolved'
}, {
taskname: 'Test6',
taskId: '7',
status: 'Submitted'
}
}]
When I input
R
I want to filter the data by matching the status value with "R". Desired output
data: [{
taskname: 'Test2',
taskId: '2',
status: 'Resolved'
}, {
taskname: 'Test5',
taskId: '6',
status: 'Resolved'
}
}]
This is my code snippet
var filteredData = data.filter(x => x.status == inputValue);
The above code snippet is not functioning as expected. Thank you for your help.