title: Read data from a text file and store it in an array of objects - NodeJS
body: <h2>Objective</h2>
  <p>I want to make this program so that it can read from a text file and store the data into an <code>Array of Objects</code>.</p>
  <p>The format shown below is the format this text file will be in, <strong>if possible the space after commas should be trimmed, but not the full string.</strong></p>
  <p>So when, this program runs it will push the content into an array which can be used later in the program as <code>array.map()</code>.</p>
  <h2>Sample Text File</h2>
  <pre><code>//file.txt (Note: The main file will always be in this exact format)
  
  John Doe, 01/30/2000, This is the Address, Los Angeles, CA, 70077 
  Jane Doe, 01/30/2000, This is the Address, Los Angeles, CA, 70077
  Arlong Doe, 01/30/2000, This is the Address, Los Angeles, CA, 70077
  Mark Doe, 01/30/2000, This is the Address, Los Angeles, CA, 70077
  Bill Doe, 01/30/2000, This is the Address, Los Angeles, CA, 70077
  
  // format: [ firstname lastname, date of birth (MM/DD/YYYY), Address, City, State, Zip]
  </code></pre>
  <h2>Desired OutPut</h2>
  <pre><code>array = [
    {
      firstname: &quot;John&quot;,
      lastname: &quot;Doe&quot;,
      dob: '01/30/2000',
      address: 'This is the Address',
      city: &quot;Los Angeles&quot;,
      state: &quot;CA&quot;,
      zip: &quot;70077&quot;
    },
    {
      firstname: &quot;Jane&quot;,
      lastname: &quot;Doe&quot;,
      dob: '01/30/2000',
      address: 'This is the Address',
      city: &quot;Los Angeles&quot;,
      state: &quot;CA&quot;,
      zip: &quot;70077&quot;
    },
    {
      firstname: &quot;Arlong&quot;,
      lastname: &quot;Doe&quot;,
      dob: '01/30/2000',
      address: 'This is the Address',
      city: &quot;Los Angeles&quot;,
      state: &quot;CA&quot;,
      zip: &quot;70077&quot;
    }
  ] //and so on
  
  
  </code></pre>