From 5ee5cc45cd84bf3bd0850d2fd090d5ac2d9e99cf Mon Sep 17 00:00:00 2001 From: Sarah Allen Date: Fri, 28 Dec 2012 07:35:37 -0800 Subject: [PATCH] Obfuscate variable and function names to aid true understanding -- suggested by timoxley --- koans/AboutFunctions.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/koans/AboutFunctions.js b/koans/AboutFunctions.js index 5fde3e2fb..05b2a345a 100644 --- a/koans/AboutFunctions.js +++ b/koans/AboutFunctions.js @@ -39,18 +39,20 @@ describe("About Functions", function() { }); it("should use lexical scoping to synthesise functions", function () { - - function makeIncreaseByFunction(increaseByAmount) { - var increaseByFunction = function increaseBy(numberToIncrease) { - return numberToIncrease + increaseByAmount; + + function makeMysteryFunction(makerValue) + { + var newFunction = function doMysteriousThing(param) + { + return makerValue + param; }; - return increaseByFunction; + return newFunction; } - - var increaseBy3 = makeIncreaseByFunction(3); - var increaseBy5 = makeIncreaseByFunction(5); - - expect(increaseBy3(10) + increaseBy5(10)).toBe(FILL_ME_IN); + + var mysteryFunction3 = makeMysteryFunction(3); + var mysteryFunction5 = makeMysteryFunction(5); + + expect(mysteryFunction3(10) + mysteryFunction5(5)).toBe(FILL_ME_IN); }); it("should allow extra function arguments", function () {