Step for Get Item by Key value

I have a list of object and want to get the item on the basis of id. Ie.

Input :

List = [{id: 1, name: test1}, {id: 2, name: test2}, {id: 3, name: test3} ]

Id = 2

 Output :

Item : {id:2, name: test2}

 Get Item By Index only work for item index, But I want to Get the item on the basis of Key-value pair. Do you know any step for this ?

Comments

Sign In or Register to comment.