如何从对象中获取特定值,这是我的示例对象和伪代码来获得我的预期结果:
items = [
{code: "1", fruits: "APPLE", color: "red"},
{code: "2", fruits: "BANANA", color: "dummy"},
{code: "3", fruits: "BANANA", color: "anotherDummy"},
{code: "4", fruits: "ORANGE", color: "orange"}
]
items.find("BANANA")
我应该循环它还是有一个可以轻松找到值的函数。
预期结果:
2,"BANANA","yellow"
3,"BANANA","anotherDummy"
呼如林
LEATH
绝地无双
相关分类