title: function to get percentage for progress bar with javascript
body: <p>I have this array:</p>
  
  <pre class="lang-js prettyprint-override"><code>[{
      "id": "5b221edea8abbc4194a62b90",
      "name": "Job one",
      "tasks": [{
          "id": "5b221edea8abbc4194a62b91",
          "name": "Task 2",
          "status": "finished",
        },
        {
          "id": "5b221edea8abbc4194a62b91",
          "name": "Task 3",
          "status": "pending",
        },
        {
          "id": "5b221edea8abbc4194a62b91",
          "name": "Task 3",
          "status": "to_do",
        },
      ]
    },
    {
      "id": "5b221edea8abbc4194a62b91",
      "name": "Job two",
      "tasks": [{
          "id": "5b221edea8abbc4194a62b96",
          "name": "Task 5",
          "status": "finished",
        },
        {
          "id": "5b221edea8abbc4194a62b97",
          "name": "Task 8",
          "status": "accepted",
        },
      ]
    },
  ]
  </code></pre>
  
  
  
  <p>All tasks is the 100% of progress bar. There are 5 tasks in this case. 100% = 5 tasks.</p>
  
  <p>I want to know what percentage the progress bar has, according to whether the task has status <strong>"finished"</strong> or not. In this case should be (100 x 2):5 = <strong>40%</strong> completed in progress bar.</p>
  
  <p>Thank you!</p>