我在我的对象数组列表中使用了 javascript array.find。仅当与该属性可用时相比,我才想获得该对象的另一个属性。与 t 相比,我得到的值为 'Value1' 与 t1 相比,我得到了未定义的值。我想检查“未定义”并仅在可用时获取值。
const t = 'abc';
const t1= 'xyz';
temp = [ {key: "abc", value: "Value1}]
temp.find( check => check.key === t ).value);
拉风的咖菲猫
慕码人2483693
慕姐8265434
相关分类