at first I thought of indexOf (), but the usage on the Internet is an one-dimensional array. What if the array contains multiple objects?
array:[
    {
        id:1,
        name:"A"
    },
    {
        id:2,
        name:"B"
    },
    {
        id:3,
        name:"B"
    }
]
console.log(this.array.id.indexOf(2)); //