Last active
November 9, 2016 21:19
-
-
Save barnes7td/b65ed78e10554d21dcdd777295437c3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INSTRUCTIONS: | |
// Create a function named createArray. This function should: | |
// 1. take four arguments | |
// 2. return an array with those arguments as elements | |
// Tests Given: | |
var expect = require("chai").expect; | |
describe("createArray", function() { | |
it("is defined", function() { | |
expect(createArray).to.exist; | |
}); | |
it("creates an array of numbers", function() { | |
expect(createArray(1,2,3,4)).to.eql([1,2,3,4]); | |
}); | |
it("creates an array of strings", function() { | |
expect(createArray("a", "b", "c", "d")).to.eql(["a", "b", "c", "d"]); | |
}); | |
it("creates an array of non-sequential elements", function() { | |
expect(createArray(1,4,2,3)).to.eql([1,4,2,3]); | |
}); | |
}); | |
// Starting Code: | |
function createArray() { | |
} | |
// Current Answer: | |
function createArray() { | |
var array = [1, 2, 3, 4]; | |
return array; | |
} | |
createArray(1, 2, 3, 4); | |
// Student: I can pass 1 test, but not both. What am I doing wrong? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment