I'm trying to search in an array and find specific objects based on their category.
But when I run my code, I only get one result. but in the example below, I should have two results because the cat 2 exists in two of the objects!
This is what I have:
var storedArray = [{
"title": "test title 1",
"date_added": "2018-09-26",
"url": "someurl.com",
"filename": "file 1",
"category": "cat 1"
}, {
"title": "test title 2",
"date_added": "2018-10-25",
"url": "someurl.com",
"filename": "file 2",
"category": "cat 2"
},{
"title": "test title 3",
"date_added": "2018-10-25",
"url": "someurl.com",
"filename": "file 3",
"category": "cat 2"
}];
var result = storedArray.find( audio => audio.category === 'cat 2' );
console.log(result);
Could someone please advice on this issue?