다음과 같은 중첩 된 개체가 있다고 상상해보십시오.
{
"post":{
"hello":{
// what's in here doesn't matter
}
"test":{
// also doesn't matter
}
}
다음과 같은 배열에 게시물 내부의 객체 이름을 얻는 방법이 있습니까?
["hello", "test"]
이 시도 Object.keys(a.post)
var a = {
"post": {
"hello": {
// what's in here doesn't matter
},
"test": {
// also doesn't matter
},
}
}
console.log(Object.keys(a.post))
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다