检查数组对象Javascript或Angular中是否存在值
问题描述:
我要检查数组对象中是否存在值,例如:
I want to check if value exist in array object, example:
我有这个数组:
[
{id: 1, name: 'foo'},
{id: 2, name: 'bar'},
{id: 3, name: 'test'}
]
我想检查一下id = 2
是否存在.
And I want check if id = 2
exist here.
谢谢