How do I select an object inside an array where the object has the the value "A" for the "slug" key?
for example if I have this:
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": "",
}
]
What I want is to put the object that contains the slug : henk inside a new variable.
So I will have something like this to work with:
var = SelectedItem = {
"slug": "henk",
"company_founded": "2012",
"company_category": "Health",
"company_logo": false,
"company_description": "",
}
Thanks!
henksubobject, why are you saying you need to get thebasone out of it?