describe("About Arrays", function() {

  //We shall contemplate truth by testing reality, via spec expectations.  
  it("should create arrays", function() {
    var emptyArray = [];
    expect(typeof(emptyArray)).toBe('object'); //A mistake? - http:javascript.crockford.com/remedial.html
    expect(emptyArray.length).toBe(0);

    var multiTypeArray = [0, 1, "two", function () { return 3; }, {value1: 4, value2: 5}, [6, 7]];
    expect(multiTypeArray[0]).toBe(0);
    expect(multiTypeArray[2]).toBe("two");
    expect(multiTypeArray[3]()).toBe(3);
    expect(multiTypeArray[4].value1).toBe(4);
    expect(multiTypeArray[4]["value2"]).toBe(5);
    expect(multiTypeArray[5][0]).toBe(6);
  });

  it("should understand array literals", function () {
    var array = [];
    expect(array).toEqual([]);
    
    array[0] = 1;
    expect(array).toEqual([1]);
    
    array[1] = 2;
    expect(array).toEqual([1, 2]);
    
    array.push(3);
    expect(array).toEqual([1, 2, 3]);
  });

  it("should understand array length", function () {
    var fourNumberArray = [1, 2, 3, 4];

    expect(fourNumberArray.length).toBe(4);
    fourNumberArray.push(5, 6);
    expect(fourNumberArray.length).toBe(6);

    var tenEmptyElementArray = new Array(10); 
    expect(tenEmptyElementArray.length).toBe(0);

    tenEmptyElementArray.length = 5;
    expect(tenEmptyElementArray.length).toBe(5);
  });

  it("should slice arrays", function () {
    var array = ["peanut", "butter", "and", "jelly"];
    
    expect(array.slice(0, 1)).toEqual("peanut");
    expect(array.slice(0, 2)).toEqual("peanut, butter");
    expect(array.slice(2, 2)).toEqual("");
    expect(array.slice(2, 20)).toEqual(FILL_ME_IN);
    expect(array.slice(3, 0)).toEqual(FILL_ME_IN);
    expect(array.slice(3, 100)).toEqual(FILL_ME_IN);
    expect(array.slice(5, 1)).toEqual(FILL_ME_IN);
  });

  it("should know array references", function () {
    var array = [ "zero", "one", "two", "three", "four", "five" ];

    function passedByReference(refArray) {
      refArray[1] = "changed in function";
    }
    passedByReference(array);
    expect(array[1]).toBe(FILL_ME_IN);

    var assignedArray = array;
    assignedArray[5] = "changed in assignedArray";
    expect(array[5]).toBe(FILL_ME_IN);

    var copyOfArray = array.slice();
    copyOfArray[3] = "changed in copyOfArray";
    expect(array[3]).toBe(FILL_ME_IN);
  });

  it("should push and pop", function () {
    var array = [1, 2];
    array.push(3);

    expect(array).toEqual(FILL_ME_IN);
    
    var poppedValue = array.pop();
    expect(poppedValue).toBe(FILL_ME_IN);
    expect(array).toEqual(FILL_ME_IN);
  });

  it("should know about shifting arrays", function () {
    var array = [1, 2];

    array.unshift(3);
    expect(array).toEqual(FILL_ME_IN);
    
    var shiftedValue = array.shift();
    expect(shiftedValue).toEqual(FILL_ME_IN);
    expect(array).toEqual(FILL_ME_IN);
  });  
});

@@ -1278,28 +1278,29 @@
 ength).toBe(
+1
 0);%0A
-
 %0A    tenEmpt
@@ -1520,24 +1520,26 @@
 toEqual(
-%22
+%5B'
 peanut
-%22
+'%5D
 );%0A    e
@@ -1575,24 +1575,28 @@
 ual(
-%22
+%5B'
 peanut
+'
 , 
+'
 butter
-%22
+'%5D
 );%0A 
@@ -1636,10 +1636,10 @@
 ual(
-%22%22
+%5B%5D
 );%0A 
@@ -1672,34 +1672,40 @@
 0)).toEqual(
-FILL_ME_IN
+%5B'and', 'jelly'%5D
 );%0A    expec
@@ -1729,34 +1729,33 @@
 0)).toEqual(
-FILL_ME_IN
+%5B'jelly'%5D
 );%0A    expec
@@ -1781,34 +1781,33 @@
 0)).toEqual(
-FILL_ME_IN
+%5B'jelly'%5D
 );%0A    expec
@@ -1831,34 +1831,34 @@
 1)).toEqual(
-FILL_ME_IN
+%5B'peanut'%5D
 );%0A  %7D);%0A%0A  
@@ -2118,34 +2118,45 @@
 ay%5B1%5D).toBe(
-FILL_ME_IN
+%22changed in function%22
 );%0A%0A    var 
@@ -2255,26 +2255,42 @@
 %5D).toBe(
-FILL_ME_IN
+%22changed in assignedArray%22
 );%0A%0A    
@@ -2391,34 +2391,48 @@
 ay%5B3%5D).toBe(
-FILL_ME_IN
+%22changed in copyOfArray%22
 );%0A  %7D);%0A%0A  

Fix Array values