如何在数组中获取此javascript对象中键的值?

如何在数组中获取此javascript对象中键的值?,javascript,arrays,object,key,Javascript,Arrays,Object,Key,我需要关键国家代码和语言代码的值 我试过了 sourceLanguageArray[0].$.country_code; sourceLanguageArray[0].$.language_code; 我得到一个错误: console.log(sourceLanguageArray[0].$.country_code); ^ ReferenceError: sourceLanguageArray is not defined 数据结构的代码和控制台日志如下所示: so

我需要关键国家代码和语言代码的值

我试过了

sourceLanguageArray[0].$.country_code;
sourceLanguageArray[0].$.language_code;
我得到一个错误:

console.log(sourceLanguageArray[0].$.country_code);
            ^
ReferenceError: sourceLanguageArray is not defined
数据结构的代码和控制台日志如下所示:

source_language (includes country_code and language_code)
const sourceLanguageArray = _.map(ontomlClass, 'source_language');

console.log(sourceLanguageArray);
// => [ [ { '$': [Object] } ], [ { '$': [Object] } ],[ { '$': [Object] } ] ]
// => [ { '$': [Object] } ]

console.log(sourceLanguageArray[0]);
// => [ { '$': { country_code: 'US', language_code: 'en' } } ]
var sourceLanguageArray=[[{'$':{country_code:'US',language_code:'en'}]];
log(“sourceLanguageArray[0]:”,sourceLanguageArray[0]);
console.log(“国家代码:”,sourceLanguageArray[0][0]。$.country_代码);
log(“语言代码:”,sourceLanguageArray[0][0]。$.language_代码)请尝试以下操作:

sourceLanguageArray.forEach(function(item){
    console.log(item[0]['$'][country_code]);
    console.log(item[0]['$'][language_code]);
})