How to output values ​​from an object in which an array. For example tooth.statusList.code

 tooth = { statusList: [ {id: 1, code: "G", "decode": "Здоров"}, {id: 2, code: "S", "decode": "Пломба"}, {id: 3, code: "C", "decode": "Коронка"}, {id: 4, code: "I", "decode": "Искусственный зуб"}, ] } 

    2 answers 2

    Addition to the answer @Igor

     var tooth = { statusList: [ {id: 1, code: "G", "decode": "Здоров"}, {id: 2, code: "S", "decode": "Пломба"}, {id: 3, code: "C", "decode": "Коронка"}, {id: 4, code: "I", "decode": "Искусственный зуб"}, ] }; tooth.statusList.map(item => { console.log(`id: ${item.id}, code: ${item.code}, decode: ${item.decode}`); }); 

    • one
      and what was added? And in this case, not map is better, but forEach - Grundy

     var tooth = { statusList: [ {id: 1, code: "G", "decode": "Здоров"}, {id: 2, code: "S", "decode": "Пломба"}, {id: 3, code: "C", "decode": "Коронка"}, {id: 4, code: "I", "decode": "Искусственный зуб"}, ] }; console.log(tooth.statusList[0].code); // G