3, 4 ]; 7 b = { 8 foo : 'bar', 9 baz : 'bim' 10 }; 11 12 fn = function() { }; 13 }); 14 15 it("you should be able to determine the location of an item in an array", function() { 16 // define a function for fn so that the following will pass 17 expect(fn(a, 3)).to.be(2); 18 }); 19 20 it("you should be able to add the values of an array", function() { 21 // define a function for fn so that the following will pass 22 expect(fn(a)).to.be(10); 23 }); 24 25 it("you should be able to remove an item from an array", function() { 26 // define a function for fn so that the following will pass 27 var result = fn(a, 2); 28 expect(result).to.have.length(3); 29 expect(result.join(' ')).to.be('1 3 4'); 30 }); 31 32 it("you should be able to add an item to the end of an array", function() { 33 // define a function for fn so that the following will pass 34 var result = fn(a, 10); 35 expect(result).to.have.length(5); 36 expect(result[result.length - 1]).to.be(10); 37 }); 38 39 it("you should be able to create an array from two arrays", function() { 40 // define a function for fn so that the following will pass 41 var c = [ 'a', 'b', 'c' ], 42 result = fn(a, c); 43 Friday, April 20, 12