title: Count unique and convert it to percentages in JS
body: <p>I am developing React app which contains data visualisation. I'll need to manipulate data with javascript library or vanilla javascript. This is what JSON data looks like: </p>
  
  <pre><code> [
    {
      "respondent": "John",
      "question 1": 1,
      "question 2": 2,
      "question 3": 7
    },
    {
      "respondent": "Steve",
      "question 1": 3,
      "question 2": 4,
      "question 3": 2
    },
    {
      "respondent": "Jack",
      "question 1": 5,
      "question 2": 3,
      "question 3": 6
    },
    {
      "respondent": "Patricia",
      "question 1": 4,
      "question 2": 3,
      "question 3": 4
    },
    {
      "respondent": "Matt",
      "question 1": 6,
      "question 2": 2,
      "question 3": 1
    }
  ]
  </code></pre>
  
  <p>Each key is the question text. The value represent poll answer between 1 and 7. </p>
  
  <p>In order to visualise it, it needs to look something like this:</p>
  
  <pre><code>const answers = [
    {"question":"question 1", "answer":"1", "percent":0.09},
    {"question":"question 1", "answer":"2", "percent":0.27},
    {"question":"question 1", "answer":"3", "percent":0.59}
    ...
    {"question":"question 3", "answer":"5", "percent":0.09},
    {"question":"question 3", "answer":"6", "percent":0.27},
    {"question":"question 3", "answer":"7", "percent":0.59}
  ]
  </code></pre>
  
  <p>So I'll need to count unique values in each question and convert it to percentages. 100% = all the answers within the same question</p>
  
  <p>How would you make this data manipulation? Here is larger dataset to play around with: <a href="https://pastebin.com/ZuyV8w6Z" rel="nofollow noreferrer">https://pastebin.com/ZuyV8w6Z</a></p>