example: get the properties of an object in an array of objects according to id
const stage = [
{ id: 0, name: "a" },
{ id: 1, name: "b" },
{ id: 2, name: "c" },
{ id: 3, name: "d" },
{ id: 4, name: "e" },
]
// 1:
// :find()undefinedname
let name = stage.find(v => v.id ===id).name
// 2:
// :
let name = stage.find(v => v.id ===id) ? stage.find(v => v.id ===id).name : "";
// 3:
// :
let find = stage.find(v => v.id ===id)
let name = find && find.name
expectation
it is hoped that all method calls can be done in one line like method 1, while avoiding the problem of errors caused by intermediate methods returning undefined.