我正在循環一個數組以檢索其中的對象。擺脫[object Object] javascript
vm.dataFilesList = [{
title: 'madrid',
name: 'castles'
}, {
title: 'spain',
name: 'horses'
}, {
title: 'story',
name: 'oslo'
}, {
title: 'beach',
name: 'miami'
}];
for (var j = 0; j < vm.dataFilesList.length; j++) {
console.log('file ' + vm.dataFilesList[j])
}
我在控制檯上看到的是:[object Object]四次;而不是:
file Object {title: "madrid", name: "castles"}
file Object {title: "spain", name: "horses"}
file Object {title: "story", name: "oslo"}
file Object {title: "beach", name: "miami"}
有什麼建議嗎?
謝謝!
看到這個答案:http://stackoverflow.com/questions/23310353/how-to-read-json-result- in-jquery/23310376#23310376這一切都是關於JavaScript對象的JSON –