How can I isolate an object from an array where the value for the "slug" key is "A"?
For instance, consider the following data:
var allItems = [
{
"slug": "henk",
"company_founded": "2008",
"company_category": "Clean",
"company_logo": false,
"company_description": "",
}
{
"id": "bas",
"company_founded": "2012",
"company_category": "Health",
"company_logo": false,
"company_description": "",
}
{
"slug": "jan",
"company_founded": "2005",
"company_category": "Clean",
"company_logo": false,
"company_description": "",
}
]
I aim to store the object with the slug value of "henk" in a new variable.
Thus, after extraction, I will be able to work with something similar to this:
var = SelectedItem = {
"slug": "henk",
"company_founded": "2012",
"company_category": "Health",
"company_logo": false,
"company_description": "",
}
Appreciate your help!