var arr = [{id:1,name:'text',id:2,name:'admin'}]var id = 2arr .findIndex(fruit => fruit.id == id) // 0