이 데모를보고 오브젝트에서 값을 추출 할 수없는 이유를 알려주십시오.JS 오브젝트에서 값을 가져올 수 없음
console.log(obj.onDays[7].name);
또는 연령 : 잭
console.log(obj.onDays[8].manyNames[1]);
:
var obj = {
webSiteName: 'StackOverFlow',
find: 'anything',
onDays: ['sun', 'mon',
'tue',
'wed',
'thu',
'fri',
'sat',
{
name: "jack",
age: 34
},
{
manyNames: ["Narayan", "Payal", "Suraj"]
},
]
};
console.log(obj.onDays[2]);
console.log(obj.onDays.manyNames[1]);
첫번째는 잘 작동 제는 obj.onDays [8] .manyNames [1] '[액세스/처리 (중첩) 객체, 배열 또는 JSON]의 – 4castle
가능한 복제 (HTTPS'이어야 /stackoverflow.com/questions/11922383/access-process-nested-objects-arrays-or-json) – 4castle