从哈希

时间:2017-09-26 20:38:15

标签: javascript jquery

我有这个哈希

data = {"05 INTERNAL":[["5e Research","66"]],"06 MISCELLANEOUS":[["6a Internal Training","69"]]}

我想获取数组中第一个键的值。 当我做的时候

Object.values(data)[0]

我得到一个由

组成的数组
[["5e Research","66"]]

如何使用jquery从中提取值"66"

感谢您的帮助!

2 个答案:

答案 0 :(得分:2)

您可以使用string引用属性,如下所示:

const data = {
  "05 INTERNAL": [
    ["5e Research", "66"]
  ],
  "06 MISCELLANEOUS": [
    ["6a Internal Training", "69"]
  ]
}

console.log(data['05 INTERNAL'][0][1])

答案 1 :(得分:1)

var data = {"05 INTERNAL":[["5e Research","66"]],"06 MISCELLANEOUS":[["6a Internal Training","69"]]};

答案是:

data['05 INTERNAL'][0][1];