25
rated 0 times
[
30]
[
5]
/ answers: 1 / hits: 197560
/ 15 Years ago, sat, january 30, 2010, 12:00:00
I have an array, I need to return a restaurant's name, but I only know the value of its food attribute (not it's index number).
For example, how could I return KFC if I only knew chicken?
restaurants =
[
{restaurant : { name : McDonald's, food : burger }},
{restaurant : { name : KFC, food : chicken }},
{restaurant : { name : Pizza Hut, food : pizza }}
];
More From » javascript