StackOverflow #40135684

HTML

<script src="http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.js"></script>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine-html.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/jasmine-html.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jasmine/2.4.1/boot.js"></script>

JavaScript

const foo = [1, 2, 3];
const bar = [3, 2, 1];

describe("Array comparison", function () {
 it("will fail since the order of these arrays is different", function () {
    expect(foo).toEqual(bar);
  });

  it("will succeed since the order remains the same", function () {
  	expect(foo.sort()).toEqual(bar.sort());
  });
});