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"]);
1var results = [];
2var searchField = "name";
3var searchVal = "my Name";
4for (var i=0 ; i < obj.list.length ; i++)
5{
6 if (obj.list[i][searchField] == searchVal) {
7 results.push(obj.list[i]);
8 }
9}
10