search

Home  >  Q&A  >  body text

javascript - How to select the first value of object data in js

How to select the first 2017 in acceptDate, the first 06 under 2017, and the first 05 under 06?

acceptDate[2017] can be selected, but what if it is dynamic?

为情所困为情所困2771 days ago700

reply all(6)I'll reply

  • 阿神

    阿神2017-06-12 09:34:36

    How can the KEY in this data format be changed at will, dynamic or not? You only need to know the key to get the value

    reply
    0
  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-06-12 09:34:36

    Object.keys can get the array composed of object keys, and then you get the first one

    reply
    0
  • 三叔

    三叔2017-06-12 09:34:36

    Object is a mapping relationship, there is no concept of order. The picture you posted is just console.log in dictionary order

    reply
    0
  • 滿天的星座

    滿天的星座2017-06-12 09:34:36

    var paramOne = "2017"
    acceptDate[paramOne]

    Dynamics are the way to get them. In the final analysis, you need to have corresponding indexes.

    reply
    0
  • 漂亮男人

    漂亮男人2017-06-12 09:34:36

    acceptDate[0][0][0]

    reply
    0
  • 学习ing

    学习ing2017-06-12 09:34:36

    I have used a similar method on keys in lodash

    http://lodash.think2011.net/keys

    reply
    0
  • Cancelreply