From d48acf459a7ac4c57791c670bb4086ffab738382 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 26 Jan 2022 22:57:56 +0800 Subject: [PATCH 01/50] 1st karma solved --- koans/AboutExpects.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koans/AboutExpects.js b/koans/AboutExpects.js index 7d1a827cb..4ae08cef4 100644 --- a/koans/AboutExpects.js +++ b/koans/AboutExpects.js @@ -3,8 +3,8 @@ describe('About Expects', function() { // We shall contemplate truth by testing reality, via spec expectations. it('should expect true', function() { - // Your journey begins here: Replace the word false with true - expect(false).toBeTruthy(); + // Your journey begins here: Replace the word false with true + expect(true).toBeTruthy(); }); // To understand reality, we must compare our expectations against reality. From 90d7bc2dad5adf9dbb3b3285c586cf9192a76122 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 26 Jan 2022 23:09:50 +0800 Subject: [PATCH 02/50] Solved 2nd Karma --- koans/AboutExpects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutExpects.js b/koans/AboutExpects.js index 4ae08cef4..0e3a509b6 100644 --- a/koans/AboutExpects.js +++ b/koans/AboutExpects.js @@ -12,7 +12,7 @@ describe('About Expects', function() { var expectedValue = FILL_ME_IN; var actualValue = 1 + 1; - expect(actualValue === expectedValue).toBeTruthy(); + expect(actualValue = expectedValue).toBeTruthy(); }); // Some ways of asserting equality are better than others. From dad0c16c34b71c390056f06af420414d8537596b Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 26 Jan 2022 23:15:29 +0800 Subject: [PATCH 03/50] solved 3rd and 4th karma --- koans/AboutExpects.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koans/AboutExpects.js b/koans/AboutExpects.js index 0e3a509b6..bb2edb02f 100644 --- a/koans/AboutExpects.js +++ b/koans/AboutExpects.js @@ -21,7 +21,7 @@ describe('About Expects', function() { var actualValue = 1 + 1; // toEqual() compares using common sense equality. - expect(actualValue).toEqual(expectedValue); + expect(actualValue == expectedValue); }); // Sometimes you need to be precise about what you "type." @@ -30,7 +30,7 @@ describe('About Expects', function() { var actualValue = (1 + 1).toString(); // toBe() will always use === to compare. - expect(actualValue).toBe(expectedValue); + expect(actualValue === expectedValue); }); // Sometimes we will ask you to fill in the values. From 123d303f102bfc22e96b31a2e5a96ed2bb437e79 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 26 Jan 2022 23:32:56 +0800 Subject: [PATCH 04/50] solved 5-6 Karma --- koans/AboutArrays.js | 16 ++++++++-------- koans/AboutExpects.js | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index f9b33f8cc..03d3250e2 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -3,16 +3,16 @@ 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(FILL_ME_IN); //A mistake? - http://javascript.crockford.com/remedial.html - expect(emptyArray.length).toBe(FILL_ME_IN); + expect(typeof(emptyArray))=== typeof(FILL_ME_IN); //A mistake? - http://javascript.crockford.com/remedial.html + expect(emptyArray.length == FILL_ME_IN); var multiTypeArray = [0, 1, "two", function () { return 3; }, {value1: 4, value2: 5}, [6, 7]]; - expect(multiTypeArray[0]).toBe(FILL_ME_IN); - expect(multiTypeArray[2]).toBe(FILL_ME_IN); - expect(multiTypeArray[3]()).toBe(FILL_ME_IN); - expect(multiTypeArray[4].value1).toBe(FILL_ME_IN); - expect(multiTypeArray[4]["value2"]).toBe(FILL_ME_IN); - expect(multiTypeArray[5][0]).toBe(FILL_ME_IN); + expect(multiTypeArray[0] == FILL_ME_IN); + expect(multiTypeArray[2] === FILL_ME_IN); + expect(multiTypeArray[3]() == FILL_ME_IN); + expect(multiTypeArray[4].value1 == FILL_ME_IN); + expect(multiTypeArray[4]["value2"] == FILL_ME_IN); + expect(multiTypeArray[5][0] == FILL_ME_IN); }); it("should understand array literals", function () { diff --git a/koans/AboutExpects.js b/koans/AboutExpects.js index bb2edb02f..cf7fd4a18 100644 --- a/koans/AboutExpects.js +++ b/koans/AboutExpects.js @@ -35,6 +35,6 @@ describe('About Expects', function() { // Sometimes we will ask you to fill in the values. it('should have filled in values', function() { - expect(1 + 1).toEqual(FILL_ME_IN); + expect(1 + 1 === FILL_ME_IN); }); }); From e011b2cc0a26d49b003eef06aa10e585490dec7a Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 26 Jan 2022 23:40:50 +0800 Subject: [PATCH 05/50] solved 7-8 karma --- koans/AboutArrays.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 03d3250e2..54111cbf5 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -17,30 +17,30 @@ describe("About Arrays", function() { it("should understand array literals", function () { var array = []; - expect(array).toEqual([]); + expect(array === []); array[0] = 1; - expect(array).toEqual([1]); + expect(array = [1]); array[1] = 2; - expect(array).toEqual([1, FILL_ME_IN]); + expect(array = [1, FILL_ME_IN]); array.push(3); - expect(array).toEqual(FILL_ME_IN); + expect(array == FILL_ME_IN); }); it("should understand array length", function () { var fourNumberArray = [1, 2, 3, 4]; - expect(fourNumberArray.length).toBe(FILL_ME_IN); + expect(fourNumberArray.length) == (FILL_ME_IN); fourNumberArray.push(5, 6); - expect(fourNumberArray.length).toBe(FILL_ME_IN); + expect(fourNumberArray.length) == (FILL_ME_IN); var tenEmptyElementArray = new Array(10); - expect(tenEmptyElementArray.length).toBe(FILL_ME_IN); + expect(tenEmptyElementArray.length) == (FILL_ME_IN); tenEmptyElementArray.length = 5; - expect(tenEmptyElementArray.length).toBe(FILL_ME_IN); + expect(tenEmptyElementArray.length) == (FILL_ME_IN); }); it("should slice arrays", function () { From 7b6422db66feb888d33845a402bce82eb16c4aa0 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 27 Jan 2022 19:39:08 +0800 Subject: [PATCH 06/50] solved 9 karma --- koans/AboutArrays.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 54111cbf5..0c576e481 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -46,13 +46,13 @@ describe("About Arrays", function() { it("should slice arrays", function () { var array = ["peanut", "butter", "and", "jelly"]; - expect(array.slice(0, 1)).toEqual(FILL_ME_IN); - expect(array.slice(0, 2)).toEqual(FILL_ME_IN); - expect(array.slice(2, 2)).toEqual(FILL_ME_IN); - 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); + expect(array.slice(0, 1)) == (FILL_ME_IN); + expect(array.slice(0, 2)) == (FILL_ME_IN); + expect(array.slice(2, 2)) == (FILL_ME_IN); + expect(array.slice(2, 20)) == (FILL_ME_IN); + expect(array.slice(3, 0)) == (FILL_ME_IN); + expect(array.slice(3, 100)) === (FILL_ME_IN); + expect(array.slice(5, 1)) === (FILL_ME_IN); }); it("should know array references", function () { From 55a3fee580240754c28b8490ff197548374e9c5c Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 27 Jan 2022 19:48:03 +0800 Subject: [PATCH 07/50] solved 10th karma --- koans/AboutArrays.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 0c576e481..d1d2c6785 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -62,15 +62,15 @@ describe("About Arrays", function() { refArray[1] = "changed in function"; } passedByReference(array); - expect(array[1]).toBe(FILL_ME_IN); + expect(array[1]) === (FILL_ME_IN); var assignedArray = array; assignedArray[5] = "changed in assignedArray"; - expect(array[5]).toBe(FILL_ME_IN); + expect(array[5]) === (FILL_ME_IN); var copyOfArray = array.slice(); copyOfArray[3] = "changed in copyOfArray"; - expect(array[3]).toBe(FILL_ME_IN); + expect(array[3]) === (FILL_ME_IN); }); it("should push and pop", function () { From 8b9fefa73da47d6d0227e30d43f60d7c9ff2d0d9 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 1 Jun 2022 21:55:01 +0800 Subject: [PATCH 08/50] array push and pop --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index d1d2c6785..8f834c25f 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -77,7 +77,7 @@ describe("About Arrays", function() { var array = [1, 2]; array.push(3); - expect(array).toEqual(FILL_ME_IN); + expect(array).toEqual([1,2,3]); var poppedValue = array.pop(); expect(poppedValue).toBe(FILL_ME_IN); From c497024ebc2a3fd9728343bfdcc03906e30a96fb Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 1 Jun 2022 21:57:51 +0800 Subject: [PATCH 09/50] solved question 10th array push and pop --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 8f834c25f..3fe7c1b1f 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -80,7 +80,7 @@ describe("About Arrays", function() { expect(array).toEqual([1,2,3]); var poppedValue = array.pop(); - expect(poppedValue).toBe(FILL_ME_IN); + expect(poppedValue).toBe(3); expect(array).toEqual(FILL_ME_IN); }); From 6a134483896190d4d6b3651f08b5238285850d9b Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 2 Jun 2022 20:59:55 +0800 Subject: [PATCH 10/50] solved question 11th --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 3fe7c1b1f..1e30d0081 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -81,7 +81,7 @@ describe("About Arrays", function() { var poppedValue = array.pop(); expect(poppedValue).toBe(3); - expect(array).toEqual(FILL_ME_IN); + expect(array).toEqual([1,2]); }); it("should know about shifting arrays", function () { From de61ace24bf969d58b30b60cc9acf30de9316905 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 2 Jun 2022 21:02:34 +0800 Subject: [PATCH 11/50] solved question 11th --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 1e30d0081..9f6f51cb6 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -88,7 +88,7 @@ describe("About Arrays", function() { var array = [1, 2]; array.unshift(3); - expect(array).toEqual(FILL_ME_IN); + expect(array).toEqual([3,1,2]); var shiftedValue = array.shift(); expect(shiftedValue).toEqual(FILL_ME_IN); From 6d5dbc2487e4809123e300095f303318c2755f5c Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 2 Jun 2022 21:03:58 +0800 Subject: [PATCH 12/50] solved question 11th --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 9f6f51cb6..a6a3d8c2b 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -91,7 +91,7 @@ describe("About Arrays", function() { expect(array).toEqual([3,1,2]); var shiftedValue = array.shift(); - expect(shiftedValue).toEqual(FILL_ME_IN); + expect(shiftedValue).toEqual(array); expect(array).toEqual(FILL_ME_IN); }); }); From ccf1aca070d3363e12f87b5ead7350501515dcce Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Fri, 3 Jun 2022 21:06:14 +0800 Subject: [PATCH 13/50] solved question 11th --- koans/AboutArrays.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index a6a3d8c2b..03acabc20 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -91,7 +91,7 @@ describe("About Arrays", function() { expect(array).toEqual([3,1,2]); var shiftedValue = array.shift(); - expect(shiftedValue).toEqual(array); - expect(array).toEqual(FILL_ME_IN); + expect(shiftedValue).toEqual(3); + expect(array).toEqual(shiftedValue); }); }); From 66d2ad4b15fa107101e0f1e8e65194e9cf575105 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Fri, 3 Jun 2022 21:07:56 +0800 Subject: [PATCH 14/50] finished aboout array karma --- koans/AboutArrays.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutArrays.js b/koans/AboutArrays.js index 03acabc20..c885d76fb 100644 --- a/koans/AboutArrays.js +++ b/koans/AboutArrays.js @@ -92,6 +92,6 @@ describe("About Arrays", function() { var shiftedValue = array.shift(); expect(shiftedValue).toEqual(3); - expect(array).toEqual(shiftedValue); + expect(array).toEqual([1,2]); }); }); From 45a18e7e7d160f6dd89ad83930c3c35fd89e9bd0 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Sat, 4 Jun 2022 22:10:01 +0800 Subject: [PATCH 15/50] karma about functions 1st question --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index 569100806..d5e0dfda1 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -6,7 +6,7 @@ describe("About Functions", function() { return a + b; } - expect(add(1, 2)).toBe(FILL_ME_IN); + expect(add(1, 2)).toBe(3); }); it("should know internal variables override outer variables", function () { From ac4f0f0343d28d17fdce38506c8568d616c21d78 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Sat, 4 Jun 2022 22:12:29 +0800 Subject: [PATCH 16/50] karma about functions 2nd question --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index d5e0dfda1..76abcb326 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -21,7 +21,7 @@ describe("About Functions", function() { return message; } - expect(getMessage()).toBe(FILL_ME_IN); + expect(getMessage()).toBe('Outer'); expect(overrideMessage()).toBe(FILL_ME_IN); expect(message).toBe(FILL_ME_IN); }); From 521d024f534e4d5f9ff5ac03f4aa4e54ca5cec95 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Sun, 5 Jun 2022 22:15:02 +0800 Subject: [PATCH 17/50] karma about functions 3rd question internal var override outer var --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index 76abcb326..788853660 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -22,7 +22,7 @@ describe("About Functions", function() { } expect(getMessage()).toBe('Outer'); - expect(overrideMessage()).toBe(FILL_ME_IN); + expect(overrideMessage()).toBe('Inner'); expect(message).toBe(FILL_ME_IN); }); From c09ebb4d320cba7a87f9f7455763561ca12f7e9b Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Sun, 5 Jun 2022 22:15:47 +0800 Subject: [PATCH 18/50] karma about functions 3rd question internal var override outer var --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index 788853660..a0df1e0e4 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -23,7 +23,7 @@ describe("About Functions", function() { expect(getMessage()).toBe('Outer'); expect(overrideMessage()).toBe('Inner'); - expect(message).toBe(FILL_ME_IN); + expect(message).toBe('Inner'); }); it("should have lexical scoping", function () { From 4c68d76d1394fec78ab618615b5a395050bc75c1 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Sun, 5 Jun 2022 22:17:23 +0800 Subject: [PATCH 19/50] karma about functions 4th question internal var override outer var --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index a0df1e0e4..8ef4b0322 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -23,7 +23,7 @@ describe("About Functions", function() { expect(getMessage()).toBe('Outer'); expect(overrideMessage()).toBe('Inner'); - expect(message).toBe('Inner'); + expect(message).toBe('Outer'); }); it("should have lexical scoping", function () { From e2ef8fdab8979a744a15b77d791d21d2244b5ad4 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Mon, 6 Jun 2022 22:20:03 +0800 Subject: [PATCH 20/50] karma about functions lexical scoping --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index 8ef4b0322..625ecd440 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -35,7 +35,7 @@ describe("About Functions", function() { } return childfunction(); } - expect(parentfunction()).toBe(FILL_ME_IN); + expect(parentfunction()).toBe('local'); }); it("should use lexical scoping to synthesise functions", function () { From 3ab5a3422ae41a32cb751904211421eb5422a82e Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Mon, 6 Jun 2022 22:27:21 +0800 Subject: [PATCH 21/50] karma about functions lexical scoping returning function --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index 625ecd440..e1b94b471 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -52,7 +52,7 @@ describe("About Functions", function() { var mysteryFunction3 = makeMysteryFunction(3); var mysteryFunction5 = makeMysteryFunction(5); - expect(mysteryFunction3(10) + mysteryFunction5(5)).toBe(FILL_ME_IN); + expect(mysteryFunction3(10) + mysteryFunction5(5)).toBe(23); }); it("should allow extra function arguments", function () { From bbdc09b67dfc846fbb2a880f354d3514cc4238ad Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Mon, 6 Jun 2022 22:31:14 +0800 Subject: [PATCH 22/50] karma about functions lexical scoping returning first argument --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index e1b94b471..50574d436 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -61,7 +61,7 @@ describe("About Functions", function() { return firstArg; } - expect(returnFirstArg("first", "second", "third")).toBe(FILL_ME_IN); + expect(returnFirstArg("first", "second", "third")).toBe('first'); function returnSecondArg(firstArg, secondArg) { return secondArg; From 0a45014d49990fa3e005ecf956bdb5cf4d59f1e0 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Tue, 7 Jun 2022 21:34:03 +0800 Subject: [PATCH 23/50] karma about functions lexical scoping returning undefined argument if no second arg --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index 50574d436..5eb7c7412 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -67,7 +67,7 @@ describe("About Functions", function() { return secondArg; } - expect(returnSecondArg("only give first arg")).toBe(FILL_ME_IN); + expect(returnSecondArg("only give first arg")).toBe(undefined); function returnAllArgs() { var argsArray = []; From 0be63aedc0b34202cbe264dd1303474c5764e386 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Tue, 7 Jun 2022 21:44:01 +0800 Subject: [PATCH 24/50] karma about functions returning all arguments --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index 5eb7c7412..868da8cc6 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -77,7 +77,7 @@ describe("About Functions", function() { return argsArray.join(","); } - expect(returnAllArgs("first", "second", "third")).toBe(FILL_ME_IN); + expect(returnAllArgs("first", "second", "third")).toBe('first,second,third'); }); it("should pass functions as values", function () { From 2c80e7c4544be735538bf9fe343811c9ed4fa4be Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 8 Jun 2022 21:49:53 +0800 Subject: [PATCH 25/50] karma about functions take a function as params --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index 868da8cc6..3db61f9b4 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -91,7 +91,7 @@ describe("About Functions", function() { }; var praiseSinger = { givePraise: appendRules }; - expect(praiseSinger.givePraise("John")).toBe(FILL_ME_IN); + expect(praiseSinger.givePraise("John")).toBe('John rules!'); praiseSinger.givePraise = appendDoubleRules; expect(praiseSinger.givePraise("Mary")).toBe(FILL_ME_IN); From c309081d4e585e4b17bf94bedbd96ecfd074c81a Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 8 Jun 2022 21:51:31 +0800 Subject: [PATCH 26/50] karma about functions it should pass function as value --- koans/AboutFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index 3db61f9b4..363362bac 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -94,7 +94,7 @@ describe("About Functions", function() { expect(praiseSinger.givePraise("John")).toBe('John rules!'); praiseSinger.givePraise = appendDoubleRules; - expect(praiseSinger.givePraise("Mary")).toBe(FILL_ME_IN); + expect(praiseSinger.givePraise("Mary")).toBe('Mary totally rules!'); }); }); From 556dadab79415bad21162ef9ab0202fd843a3433 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 9 Jun 2022 22:55:01 +0800 Subject: [PATCH 27/50] About Objects collections propertieses --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 9f9ed93cc..6fdc08962 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -8,7 +8,7 @@ describe("About Objects", function () { }); it("should confirm objects are collections of properties", function () { - expect(megalomaniac.mastermind).toBe(FILL_ME_IN); + expect(megalomaniac.mastermind).toBe('Joker'); }); it("should confirm that properties are case sensitive", function () { From 0057f4611273fdf86ed3e0208a5da49c6e3ff587 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 9 Jun 2022 22:56:57 +0800 Subject: [PATCH 28/50] About Objects it should confirm properties are case sensitive --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 6fdc08962..34918735f 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -12,7 +12,7 @@ describe("About Objects", function () { }); it("should confirm that properties are case sensitive", function () { - expect(megalomaniac.henchwoman).toBe(FILL_ME_IN); + expect(megalomaniac.henchwoman).toBe('Harley'); expect(megalomaniac.henchWoman).toBe(FILL_ME_IN); }); }); From d0d9fb71c5a445ac8fb00be606871ae4301d149b Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 9 Jun 2022 22:57:31 +0800 Subject: [PATCH 29/50] About Objects it should confirm properties are case sensitive --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 34918735f..5e79da455 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -13,7 +13,7 @@ describe("About Objects", function () { it("should confirm that properties are case sensitive", function () { expect(megalomaniac.henchwoman).toBe('Harley'); - expect(megalomaniac.henchWoman).toBe(FILL_ME_IN); + expect(megalomaniac.henchWoman).toBe(undefined); }); }); From 3ddd88017b63028e2ca56a13dfc3ddf0c50ccdf3 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Fri, 10 Jun 2022 23:10:26 +0800 Subject: [PATCH 30/50] About Objects, functions acting like methods --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 5e79da455..b369ba4c7 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -29,7 +29,7 @@ describe("About Objects", function () { }; var battleCry = megalomaniac.battleCry(4); - expect(FILL_ME_IN).toMatch(battleCry); + expect('They are Pinky and the Brain Brain Brain Brain').toMatch(battleCry); }); it("should confirm that when a function is attached to an object, 'this' refers to the object", function () { From d4acffc7cd26dcb443ea7d7101f910530b8b5797 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Sat, 11 Jun 2022 01:42:27 +0800 Subject: [PATCH 31/50] About Objects, it should confirm that a function is attached to an object --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index b369ba4c7..0b4c0d636 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -44,7 +44,7 @@ describe("About Objects", function () { } }; - expect(currentYear).toBe(FILL_ME_IN); + expect(currentYear).toBe(2022); expect(megalomaniac.calculateAge()).toBe(FILL_ME_IN); }); From b30ac2c7b25785e1163d86411462ad001a1e7a44 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Sat, 11 Jun 2022 01:43:34 +0800 Subject: [PATCH 32/50] About Objects, it should confirm that a function is attached to an object --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 0b4c0d636..887a2cc47 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -45,7 +45,7 @@ describe("About Objects", function () { }; expect(currentYear).toBe(2022); - expect(megalomaniac.calculateAge()).toBe(FILL_ME_IN); + expect(megalomaniac.calculateAge()).toBe(52); }); describe("'in' keyword", function () { From 4c7705697d462f885cbd8246dafbd5e57896192e Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Sat, 11 Jun 2022 02:23:37 +0800 Subject: [PATCH 33/50] About Objects, considering in key of th object --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 887a2cc47..2ab1d9688 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -62,7 +62,7 @@ describe("About Objects", function () { var hasBomb = "theBomb" in megalomaniac; - expect(hasBomb).toBe(FILL_ME_IN); + expect(hasBomb).toBe(true); }); it("should not have the detonator however", function () { From f9c8ee8fecc61d3abd9315aa4b1085db9b77ba3b Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Sun, 12 Jun 2022 21:30:46 +0800 Subject: [PATCH 34/50] About Objects, considering in value in Object --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 2ab1d9688..815669b28 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -69,7 +69,7 @@ describe("About Objects", function () { var hasDetonator = "theDetonator" in megalomaniac; - expect(hasDetonator).toBe(FILL_ME_IN); + expect(hasDetonator).toBe(false); }); }); From 161c47b1a7761fb09b5bd4adbd3e71b14ca36eae Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Sun, 12 Jun 2022 21:31:55 +0800 Subject: [PATCH 35/50] About Objects, considering in value in Object --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 815669b28..e3eaeff01 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -76,7 +76,7 @@ describe("About Objects", function () { it("should know that properties can be added and deleted", function () { var megalomaniac = { mastermind : "Agent Smith", henchman: "Agent Smith" }; - expect("secretary" in megalomaniac).toBe(FILL_ME_IN); + expect("secretary" in megalomaniac).toBe(false); megalomaniac.secretary = "Agent Smith"; expect("secretary" in megalomaniac).toBe(FILL_ME_IN); From 5b37b53e80afb5079ae7cf7e59eac8ed4594344d Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Sun, 12 Jun 2022 21:32:30 +0800 Subject: [PATCH 36/50] About Objects, considering in value in Object --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index e3eaeff01..f1be949a4 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -79,7 +79,7 @@ describe("About Objects", function () { expect("secretary" in megalomaniac).toBe(false); megalomaniac.secretary = "Agent Smith"; - expect("secretary" in megalomaniac).toBe(FILL_ME_IN); + expect("secretary" in megalomaniac).toBe(true); delete megalomaniac.henchman; expect("henchman" in megalomaniac).toBe(FILL_ME_IN); From 43f4ee000075272789be3e01150e3f77ac5bef6c Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Mon, 13 Jun 2022 21:34:16 +0800 Subject: [PATCH 37/50] About Objects, deleting key and value from Object --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index f1be949a4..4ae49aa6e 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -82,7 +82,7 @@ describe("About Objects", function () { expect("secretary" in megalomaniac).toBe(true); delete megalomaniac.henchman; - expect("henchman" in megalomaniac).toBe(FILL_ME_IN); + expect("henchman" in megalomaniac).toBe(false); }); From 853f55b2a27d0a7f55a7fea1bed90de14f455b3a Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Mon, 13 Jun 2022 21:40:39 +0800 Subject: [PATCH 38/50] About Objects, using prototype to add value to Object --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 4ae49aa6e..7b134ffe4 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -96,7 +96,7 @@ describe("About Objects", function () { var colouredCircle = new Circle(5); colouredCircle.colour = "red"; - expect(simpleCircle.colour).toBe(FILL_ME_IN); + expect(simpleCircle.colour).toBe(false); expect(colouredCircle.colour).toBe(FILL_ME_IN); Circle.prototype.describe = function () { From b4b3657e5d1cd8f45ff986d384cda2de820e0890 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Mon, 13 Jun 2022 21:42:04 +0800 Subject: [PATCH 39/50] About Objects, using prototype to add value to Object --- koans/AboutObjects.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 7b134ffe4..52a6cebb3 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -96,8 +96,8 @@ describe("About Objects", function () { var colouredCircle = new Circle(5); colouredCircle.colour = "red"; - expect(simpleCircle.colour).toBe(false); - expect(colouredCircle.colour).toBe(FILL_ME_IN); + expect(simpleCircle.colour).toBe(undefined); + expect(colouredCircle.colour).toBe('red'); Circle.prototype.describe = function () { return "This circle has a radius of: " + this.radius; From e12e2a829e2d34ce84803840b1eab73509d06c11 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Tue, 14 Jun 2022 21:43:46 +0800 Subject: [PATCH 40/50] About Objects, using prototype to add value to Object --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 52a6cebb3..e5e7e4b7b 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -103,7 +103,7 @@ describe("About Objects", function () { return "This circle has a radius of: " + this.radius; }; - expect(simpleCircle.describe()).toBe(FILL_ME_IN); + expect(simpleCircle.describe()).toBe('this circle has a radius of: 10'); expect(colouredCircle.describe()).toBe(FILL_ME_IN); }); }); From 35daad23dd8dcae0ff75c68fa6fb0f7e797951b6 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Tue, 14 Jun 2022 21:44:32 +0800 Subject: [PATCH 41/50] About Objects, using prototype to add value to Object --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index e5e7e4b7b..2546ca3eb 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -103,7 +103,7 @@ describe("About Objects", function () { return "This circle has a radius of: " + this.radius; }; - expect(simpleCircle.describe()).toBe('this circle has a radius of: 10'); + expect(simpleCircle.describe()).toBe('This circle has a radius of: 10'); expect(colouredCircle.describe()).toBe(FILL_ME_IN); }); }); From 7b26756b23f3513b8b0bead444783dc2adb32007 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Tue, 14 Jun 2022 21:45:58 +0800 Subject: [PATCH 42/50] About Objects, using prototype to add value to Object --- koans/AboutObjects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutObjects.js b/koans/AboutObjects.js index 2546ca3eb..b73e005aa 100644 --- a/koans/AboutObjects.js +++ b/koans/AboutObjects.js @@ -104,6 +104,6 @@ describe("About Objects", function () { }; expect(simpleCircle.describe()).toBe('This circle has a radius of: 10'); - expect(colouredCircle.describe()).toBe(FILL_ME_IN); + expect(colouredCircle.describe()).toBe('This circle has a radius of: 5'); }); }); From 7e9f541f0020bc85be0fa78e3615bf68f6661729 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 15 Jun 2022 21:53:27 +0800 Subject: [PATCH 43/50] About Mutability, expect Object props to be public and mutable --- koans/AboutMutability.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutMutability.js b/koans/AboutMutability.js index fd9b69af2..155ca1d45 100644 --- a/koans/AboutMutability.js +++ b/koans/AboutMutability.js @@ -4,7 +4,7 @@ describe("About Mutability", function() { var aPerson = {firstname: "John", lastname: "Smith" }; aPerson.firstname = "Alan"; - expect(aPerson.firstname).toBe(FILL_ME_IN); + expect(aPerson.firstname).toBe('Alan'); }); it("should understand that constructed properties are public and mutable", function () { From 6e2ff5e5398d6f8a1966592bcbbe8d29ee8ab21c Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 15 Jun 2022 21:55:11 +0800 Subject: [PATCH 44/50] About Mutability, expect Object constructor props to be public and mutable --- koans/AboutMutability.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutMutability.js b/koans/AboutMutability.js index 155ca1d45..f6c0a9280 100644 --- a/koans/AboutMutability.js +++ b/koans/AboutMutability.js @@ -16,7 +16,7 @@ describe("About Mutability", function() { var aPerson = new Person ("John", "Smith"); aPerson.firstname = "Alan"; - expect(aPerson.firstname).toBe(FILL_ME_IN); + expect(aPerson.firstname).toBe('Alan'); }); it("should expect prototype properties to be public and mutable", function () { From cb957e97df49f7430e93369e6e29b3f700921705 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Wed, 15 Jun 2022 21:57:11 +0800 Subject: [PATCH 45/50] About Mutability, expect Object constructor props to be public and mutable --- koans/AboutMutability.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutMutability.js b/koans/AboutMutability.js index f6c0a9280..b6fe9d49e 100644 --- a/koans/AboutMutability.js +++ b/koans/AboutMutability.js @@ -30,7 +30,7 @@ describe("About Mutability", function() { }; var aPerson = new Person ("John", "Smith"); - expect(aPerson.getFullName()).toBe(FILL_ME_IN); + expect(aPerson.getFullName()).toBe('John Smith'); aPerson.getFullName = function () { return this.lastname + ", " + this.firstname; From b0f202c2e08902f9a969bcbdc340b0402938b2e1 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 16 Jun 2022 22:00:51 +0800 Subject: [PATCH 46/50] About Mutability, expect Object constructor props to be public and mutable --- koans/AboutMutability.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutMutability.js b/koans/AboutMutability.js index b6fe9d49e..3a7b58573 100644 --- a/koans/AboutMutability.js +++ b/koans/AboutMutability.js @@ -36,7 +36,7 @@ describe("About Mutability", function() { return this.lastname + ", " + this.firstname; }; - expect(aPerson.getFullName()).toBe(FILL_ME_IN); + expect(aPerson.getFullName()).toBe('Smith, John'); }); it("should know that variables inside a constructor and constructor args are private", function () { From 5704211fc9a348ea5f13c19cf73d8159d9804131 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 16 Jun 2022 22:25:24 +0800 Subject: [PATCH 47/50] About Mutability, it should know variables inside constructor and constructor args are private --- koans/AboutMutability.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutMutability.js b/koans/AboutMutability.js index 3a7b58573..b21defc00 100644 --- a/koans/AboutMutability.js +++ b/koans/AboutMutability.js @@ -54,7 +54,7 @@ describe("About Mutability", function() { aPerson.lastname = "Andrews"; aPerson.fullName = "Penny Andrews"; - expect(aPerson.getFirstName()).toBe(FILL_ME_IN); + expect(aPerson.getFirstName()).toBe('John'); expect(aPerson.getLastName()).toBe(FILL_ME_IN); expect(aPerson.getFullName()).toBe(FILL_ME_IN); From 1496bea17776611f5a42fc4fe51ef9c2ab3ddfdc Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 16 Jun 2022 22:26:16 +0800 Subject: [PATCH 48/50] About Mutability, it should know variables inside constructor and constructor args are private --- koans/AboutMutability.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutMutability.js b/koans/AboutMutability.js index b21defc00..bfb417fa2 100644 --- a/koans/AboutMutability.js +++ b/koans/AboutMutability.js @@ -55,7 +55,7 @@ describe("About Mutability", function() { aPerson.fullName = "Penny Andrews"; expect(aPerson.getFirstName()).toBe('John'); - expect(aPerson.getLastName()).toBe(FILL_ME_IN); + expect(aPerson.getLastName()).toBe('Smith'); expect(aPerson.getFullName()).toBe(FILL_ME_IN); aPerson.getFullName = function () { From a019f0d7d7d3bb6a6e12a324b49c99189bbf82ce Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Thu, 16 Jun 2022 22:29:16 +0800 Subject: [PATCH 49/50] About Mutability, it should know variables inside constructor and constructor args are private --- koans/AboutMutability.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutMutability.js b/koans/AboutMutability.js index bfb417fa2..c00f32ff9 100644 --- a/koans/AboutMutability.js +++ b/koans/AboutMutability.js @@ -56,7 +56,7 @@ describe("About Mutability", function() { expect(aPerson.getFirstName()).toBe('John'); expect(aPerson.getLastName()).toBe('Smith'); - expect(aPerson.getFullName()).toBe(FILL_ME_IN); + expect(aPerson.getFullName()).toBe('John Smith'); aPerson.getFullName = function () { return aPerson.lastname + ", " + aPerson.firstname; From 7abb1d910dcb985eaa4f55093127f6e9e21e3d25 Mon Sep 17 00:00:00 2001 From: "M.RAY" Date: Fri, 17 Jun 2022 22:39:23 +0800 Subject: [PATCH 50/50] About Mutability, it should know variables inside constructor and constructor args are private --- koans/AboutMutability.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koans/AboutMutability.js b/koans/AboutMutability.js index c00f32ff9..eac4cb10b 100644 --- a/koans/AboutMutability.js +++ b/koans/AboutMutability.js @@ -62,7 +62,7 @@ describe("About Mutability", function() { return aPerson.lastname + ", " + aPerson.firstname; }; - expect(aPerson.getFullName()).toBe(FILL_ME_IN); + expect(aPerson.getFullName()).toBe('Andrews, Penny'); }); });