I have a simple array with id and name. If i know the id then how can i fetch the name, array is shown below:
var dataobj = [
{id:1,name:"Jessica"},
{id:2,name:"Tom"},
{id:3,name:"Will"}
];
i have the id
for example 2 with me in a variable, how can i get the name which belongs to this id ?
I have clickedID=2
value in my slist.component.ts and i want to fetch its corresponding name
, how can i do it ?