javascript find json value

Solutions on MaxInterview for javascript find json value by the best coders in the world

showing results for - "javascript find json value"
Matthew
24 Sep 2019
1var data=[{name:"Afghanistan",code:"AF"},{name:"Åland Islands",code:"AX"},{name:"Albania",code:"AL"},{name:"Algeria",code:"DZ"}];
2
3let country = data.find(el => el.code === "AL");
4// => {name: "Albania", code: "AL"}
5console.log(country["name"]);