//Your logs array
const logs = [
{name:'log1', kind:'error'},
{name:'log2', kind:'warning'},
{name:'log3', kind:'info'},
{name:'log4', kind:'error'},
];
//The function to filter the array
function filterLogs(logs, kind) {
console.log(logs);
return logs.filter(log => {
return log.kind === kind
});
}
// the value to show somewhere
const stuffToShow = filterLogs(logs,'error');
Надеюсь, это поможет !!! :)