我正在尝试使用map
访问我的Title值,但是却收到一条错误消息,指出“结果”未定义。基于JS对象的结构,我不确定为什么会出现错误。我不知道它指的是哪个结果,但我相信这是第一个结果。
]).then(axios.spread((cat) => {
_categories = cat.data.d.results;
// irrelevant code here
loadCategories(){
let categs = _categories,
trainingCrs = _categories.d.results.Courses.results.map(x => x.Title);
console.log(trainingCrs);
}
{
"d": {
"results": [
{
"__metadata": {
"id": "N/A",
"type": "N/A"
},
"Courses": {
"results": [
{
"__metadata": {
"id": "N/A",
"type": "N/A"
},
"Title": "Capuchin Monkey"
},
{
"__metadata": {
"id": "N/A",
"type": "N/A"
},
"Title": "Capybara"
},