title: Read JSON with Current Date and get key value using Javascript?
body: <p>I am trying to get the count from <code>JSON</code> response which has current date in the key.</p>
  
  <p><code>Json</code> Response:</p>
  
  <pre><code>[
    {
      "type": {
        "id": "mobile",
        "name": "mobile",
        "description": "",
        "total_count": 0
      },
      "counts": [
        {
          "date": "2018-09-06",
          "timestamp": 1536192000000,
          "count": 20
        },
        {
          "date": "2018-09-07",
          "timestamp": 1536278400000,
          "count": 10
        }
      ]
    },
    {
      "type": {
        "id": "lap",
        "name": "lap",
        "description": "",
        "total_count": 0
      },
      "counts": [
        {
          "date": "2018-09-06",
          "timestamp": 1536192000000,
          "count": 19
        },
        {
          "date": "2018-09-07",
          "timestamp": 1536278400000,
          "count": 20
        }
      ]
    }
  ]
  </code></pre>
  
  <p>My New try as per vikscool code:</p>
  
  <pre><code>var json_count = JSON.parse(getcounts);
  var curDate = getCurrentDate();
  var mobilcount = () =&gt; json_count.map(ct =&gt; {
    const count = ct.counts;
    const getDate = count.find(dt =&gt; dt.date === curDate);
    window.alert('count is ', getDate.count);
    return {getDate};
  });
  mobilcount();
  
  function getCurrentDate () {
    var nowDate = new Date();
    var month = (nowDate.getMonth() + 1).toString().length == 1
      ? '0' + (nowDate.getMonth() + 1)
      : (nowDate.getMonth() + 1);
  
    var day = nowDate.getDate().toString().length == 1
      ? '0' + nowDate.getDate()
      : +nowDate.getDate();
  
    return nowDate.getFullYear() + '-' + month + '-' + day;
  }
  </code></pre>
  
  <p>output: "count is "</p>
  
  <p>but there is no count printed from json.</p>
  
  <p>Is there any solution in <code>Javascript</code> I can get the current date and get the counts.</p>
  
  <p>I need to get the <em>count as 10 in mobilcount</em>.</p>