📜  javascript-find-json-value - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:55.598000             🧑  作者: Mango

代码示例1
var data=[{name:"Afghanistan",code:"AF"},{name:"Åland Islands",code:"AX"},{name:"Albania",code:"AL"},{name:"Algeria",code:"DZ"}];

let country = data.find(el => el.code === "AL");
// => {name: "Albania", code: "AL"}
console.log(country["name"]);