Imagine having a global array with the following content:
{
id: 1,
name: test,
age: 23,
toys: [
{ id: 2, label: mouse },
{ id: 1, label: house },
{ id: 4, label: car }
]
}
The objective is to specifically extract the toy array of a certain child id
by utilizing ES6 TypeScript.
Here's what I attempted:
this.toys = this.kids.find(kid => kid.id === KidId);
I appreciate any assistance provided. Thank you.