Skip to content

Commit 2b57c93

Browse files
completed the AboutFunctions tasks
1 parent 9a08006 commit 2b57c93

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

koans/AboutFunctions.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe("About Functions", function() {
66
return a + b;
77
}
88

9-
expect(add(1, 2)).toBe(FILL_ME_IN);
9+
expect(add(1, 2)).toBe(3);
1010
});
1111

1212
it("should know internal variables override outer variables", function () {
@@ -21,9 +21,9 @@ describe("About Functions", function() {
2121
return message;
2222
}
2323

24-
expect(getMessage()).toBe(FILL_ME_IN);
25-
expect(overrideMessage()).toBe(FILL_ME_IN);
26-
expect(message).toBe(FILL_ME_IN);
24+
expect(getMessage()).toBe("Outer");
25+
expect(overrideMessage()).toBe("Inner");
26+
expect(message).toBe("Outer");
2727
});
2828

2929
it("should have lexical scoping", function () {
@@ -35,7 +35,7 @@ describe("About Functions", function() {
3535
}
3636
return childfunction();
3737
}
38-
expect(parentfunction()).toBe(FILL_ME_IN);
38+
expect(parentfunction()).toBe("local");
3939
});
4040

4141
it("should use lexical scoping to synthesise functions", function () {
@@ -52,7 +52,7 @@ describe("About Functions", function() {
5252
var mysteryFunction3 = makeMysteryFunction(3);
5353
var mysteryFunction5 = makeMysteryFunction(5);
5454

55-
expect(mysteryFunction3(10) + mysteryFunction5(5)).toBe(FILL_ME_IN);
55+
expect(mysteryFunction3(10) + mysteryFunction5(5)).toBe(23);
5656
});
5757

5858
it("should allow extra function arguments", function () {
@@ -61,13 +61,13 @@ describe("About Functions", function() {
6161
return firstArg;
6262
}
6363

64-
expect(returnFirstArg("first", "second", "third")).toBe(FILL_ME_IN);
64+
expect(returnFirstArg("first", "second", "third")).toBe("first");
6565

6666
function returnSecondArg(firstArg, secondArg) {
6767
return secondArg;
6868
}
6969

70-
expect(returnSecondArg("only give first arg")).toBe(FILL_ME_IN);
70+
expect(returnSecondArg("only give first arg")).toBe(undefined);
7171

7272
function returnAllArgs() {
7373
var argsArray = [];
@@ -77,7 +77,7 @@ describe("About Functions", function() {
7777
return argsArray.join(",");
7878
}
7979

80-
expect(returnAllArgs("first", "second", "third")).toBe(FILL_ME_IN);
80+
expect(returnAllArgs("first", "second", "third")).toBe("first,second,third");
8181
});
8282

8383
it("should pass functions as values", function () {
@@ -91,10 +91,10 @@ describe("About Functions", function() {
9191
};
9292

9393
var praiseSinger = { givePraise: appendRules };
94-
expect(praiseSinger.givePraise("John")).toBe(FILL_ME_IN);
94+
expect(praiseSinger.givePraise("John")).toBe("John rules!");
9595

9696
praiseSinger.givePraise = appendDoubleRules;
97-
expect(praiseSinger.givePraise("Mary")).toBe(FILL_ME_IN);
97+
expect(praiseSinger.givePraise("Mary")).toBe("Mary totally rules!");
9898

9999
});
100100
});

0 commit comments

Comments
 (0)