I need to detect an object in an array with its Id.
My first array looks like that:
{ [id: 9, name: 'abc'], [id: 2, name 'def'], [id: 40, name: 'gh'] } (Id & name)
,
while that other array is:
{ [class: 'physics', Tid: 9], [class: 'computer science', Tid: 9], [class: 'Biology', Tid: 40] }.
I need to match the parameter "name
" from the first array by its ID to its "class
" (for example, "physics"
relates to Tid=9
which is "abc"
and "Biology"
relates to Tid=40
which is "gh"
).
How can I elegantly do so without changing the way the data comes? (It comes from a database with ASP.NET web service in JSON)