title: Count age within its range in javascript
body: <p>Having trouble lately about counting the duplicate array ang make it object. Now, I'm trying to solve counting age with its range.
  I have this code snippet to count duplicate age.</p>
  
  <pre><code>const age = [5, 5, 16, 5, 16];
  
  const sumAge = {};
  for (const datum of age) {
      let entry = sumAge[datum];
      if (entry) {
          ++entry.count;
      } else {
          sumAge[datum] = {age: datum, count: 1};
      }
  }
  
  console.log(Object.values(sumAge));
  </code></pre>
  
  <p>I have a result</p>
  
  <pre><code>{
     age:5,
     value: 3
  },
  {
     age:16,
     value: 2
  }
  </code></pre>
  
  <p>Ivm trying to solve this expected result</p>
  
  <pre><code>{
     age:5-15,
     value: 3
  },
  {
     age:16-30,
     value: 2
  }
  </code></pre>