title: How to split array dynamically based on single value in JavaScript Node.js
body: <p>I need to split array dynamically based on single value in JavaScript.</p>
  
  <p>I've got an array:</p>
  
  <pre><code>var dataStuff = [
      { Name: 'Apple', Tag: 'Fruit', Price: '2,5'},
      { Name: 'Bike', Tag: 'Sport', Price: '150'},
      { Name: 'Kiwi', Tag: 'Fruit', Price: '1,5'},
      { Name: 'Knife', Tag: 'Kitchen', Price: '8'},
      { Name: 'Fork', Tag: 'Kitchen', Price: '7'}
  ];
  </code></pre>
  
  <p>And i expect arrays split by Tag,
  eg.</p>
  
  <pre><code>var Fruit = [
      { Name: 'Apple', Tag: 'Fruit', Price: '2,5'},
      { Name: 'Kiwi', Tag: 'Fruit', Price: '1,5'}
  ];
  
  var Sport = [
      { Name: 'Bike', Tag: 'Sport', Price: '150'}
  ];
  
  var Kitchen = [
      { Name: 'Knife', Tag: 'Kitchen', Price: '8'},
      { Name: 'Fork', Tag: 'Kitchen', Price: '7'}
  ];
  </code></pre>
  
  <p>If in dataStuff array will be more <strong>Tags</strong> then in result will be more arrays.
  Anyway i don't have idea how should I do this. I'm using node.js + Jade (for view), and i think the best idea will be do this at view because i have to put each array in <strong>table</strong>. Maybe something like this:</p>
  
  <pre><code>// Basic table
  tbody
       - each item in dataStuff
           tr
              td= item.Name
              td= item.Tag
              td= item.Price
  
  // Other tables
  - each item in dataStuff
      item.Tag.push(item);
      // adding items to array based on Tag
      // probably it won't work 
      // but still how should i draw table?
  </code></pre>
  
  <p>I would be grateful for any help</p>