<分区>
我有一个 JavaScript 对象,它有多个层次,例如:
let obj = [
{
"testKeyOne": "one",
"testKeyTwo": "two"
},
{
"testKeyThree": "three",
"testKeyFour": "four",
"testKeyFive": {
"testKeyFiveAndAHalf": "5.5"
"testKeyFiveAndThreeQuarters": "5.75"
}
},
]
我还有一个数组,用于存储我需要访问的内容的键,例如,如果我正在寻找 5.5
一个,
let array = [1, "testKeyFive", "testKeyFiveAndAHalf"]
尽管如果我正在寻找"one"
let array = [0, "testKeyOne"]
有什么方法可以使用数组来获取想要的值吗?
这是我第一次提问,所以如果我搞砸了,或者有任何不清楚的地方或需要更改的地方,我深表歉意。
谢谢!