title: Testing String.split() with Mocha fails even though expected and result are the same
body: <p>I am currently getting into TDD and I wanted to write a test for a simple 'String.split()'.</p>
  
  <p>The function should return an array of words that are contained in a String.</p>
  
  <pre><code>export function splitSentence(inputSentence) {
      const result = inputSentence.split(' ');
      return result;
  }
  </code></pre>
  
  <p>I am using <code>mocha</code> as testing framework and <code>chai</code> for the assertion.</p>
  
  <p>Here is the test.</p>
  
  <pre><code>describe('String Split', () =&gt; {
    it('should split a string into an array of words', () =&gt; {
      const inputString = 'This is some text';
      const expectedResult = ['This', 'is', 'some', 'text'];
      expect(splitSentence(inputString)).to.equal(expectedResult);
    });
  });
  </code></pre>
  
  <p>While testing everything in the browser console it worked fine so I was confident that it would pass the test. However it failed with the following error message.</p>
  
  <pre><code>  AssertionError: expected [ 'This', 'is', 'some', 'text' ] to equal [ 'This', 'is', 'some', 'text' ]`
  </code></pre>
  
  <p>After looking at the error message it seems like they are both equal so I am currently wondering what went wrong here.</p>
  
  <p>Thank your for your help.</p>