I've got an JSON object which looks like this:
const object = [
{
name: 'first',
color: 'red',
structure:
{
height: 50,
width: 20
}
},
{
name: 'second',
color: 'blue',
structure:
{
height: 10,
width: 60
}
},
{
name: 'third',
color: 'green',
structure:
{
height: 80,
width: 40
}
}
];
I'd now like to find the index of the JSON Object with 'name: second' how do I do this without looping with javscript/typescript and without jQuery? If I want the index of 'name: second' the result should be '1'.