Giter Club home page Giter Club logo

javascript-koans's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javascript-koans's Issues

aboutObjects line 68 has a missing property

it("should not have the detonator however", function () {
hasDetonator = "theDetonator" in meglomaniac;
expect(hasDetonator).toBe(FILL_ME_IN);
});

"theDetonator" property is missing in the object:

var meglomaniac;
beforeEach(function () {
meglomaniac = {
mastermind: "The Monarch",
henchwoman: "Dr Girlfriend",
theBomb: true
};
});

Remove Koans related to dojo

Is there a reason for including koans related to dojo? I don't understand what leaning dojo has to do with learning javascript. Can they be moved out to a separate repo called dojo-koans?

requires original syntax of chain for koan 53

Using a more recent chain syntax, `_.chain(collection)`, will cause errors.
Koan 53 requires the original syntax of : `_(collection).chain`.

The more recent chain syntax was added more than 4 years ago,
and causes confusion when otherwise correct code produces errors.
Adding a note to koan 53 should remove this source of confusion
for users familiar with the newer `_.chain(collection)` syntax.

reference notes:
javascript-koans uses underscore v 1.1.6 from  Apr 2011
newer chain syntax was added in v 1.2.3 on 30 Dec 2011 as fix #408
current underscore library is v 1.8.3

5 Brains, not 4

AboutObjects.js line 32 has an expected answer of "They are Pinky and the Brain Brain Brain Brain" -- with 4 iterations of the string "Brain".

The actual pseudo code is:

var megalomaniac = {
  mastermind : "Brain",
  henchman: "Pinky",
  battleCry: function (noOfBrains) {
    return "They are " + this.henchman + " and the" +
      Array(noOfBrains + 1).join(" " + this.mastermind);
  }
};

The problem in question was:

var battleCry = megalomaniac.battleCry(4);

If we indeed pass 4 as noOfBrains, since the method adds 1 to noOfBrains before joining them, would the result not have 5 "Brain"?

function body as a string test

var multiply = function (a, b) {
//An internal comment
return a * b;
};
var stupid = "function (a, b) {
return a * b;
}"
expect(multiply.toString()).toBe(stupid);

why doesn't that work? if i remove the '' lien terminators it works but Firefox throws an unterminated string literal error.

Disappearing Koan — AboutApplyingWhatWeHaveLearnt

When refreshing the browser to test the second koan, the entire section for AboutApplyingWhatWeHaveLearnt disappears. Commenting the attempted solution and refreshing the browser brings back the section with the first koan passed and the second koan in red like before.

update "any" to "some" in AboutHigherOrderFunctions.js

it("should use 'any' to test if any items passes condition" , function () {
    var onlyEven = [2,4,6];
    var mixedBag = [2,4,5,6];

    var isEven = function(x) { return x % 2 === 0 };

    expect(_(onlyEven).any(isEven)).toBe(true);
    expect(_(mixedBag).any(isEven)).toBe(true);
  });

in lines 60-68 of AboutHigherOrderFunctions.js should be updated to use "some" instead of "any"

it looks like "any" has been deprecated?

Being really exact

Thanks for making these, good fun!
I'm going to fix a few typos and do a pull request..
also, I wonder if this drives the point home further?

it("should assert equality with ===", function () {
  var expectedValue = "2";
  var actualValue = (1 + 1).toString();

  // toBe() will always use === to compare
  expect(actualValue).toBe(expectedValue);
});

flatten not working for products array in AboutApplyingWhatWeHaveLearnt.js

In the very last challenge in AboutApplyingWhatWeHaveLearnt.js, it("should count the ingredient occurrence (imperative)", I tried replacing the FILL_ME_IN placeholder with _(products).flatten() to see what the effect would be. The output to the browser in KoansRunner.html is as follows:

[ { name : 'Sonoma', ingredients : [ 'artichoke', 'sundried tomatoes', 'mushrooms' ], containsNuts : false, beget : Function }, { name : 'Pizza Primavera', ingredients : [ 'roma', 'sundried tomatoes', 'goats cheese', 'rosemary' ], containsNuts : false, beget : Function }, { name : 'South Of The Border', ingredients : [ 'black beans', 'jalapenos', 'mushrooms' ], containsNuts : false, beget : Function }, { name : 'Blue Moon', ingredients : [ 'blue cheese', 'garlic', 'walnuts' ], containsNuts : true, beget : Function }, { name : 'Taste Of Athens', ingredients : [ 'spinach', 'kalamata olives', 'sesame seeds' ], containsNuts : true, beget : Function } ]

It appears to me that the flatten function isn't actually doing anything to the products array. Am I misusing the function or is there a problem?

Obfuscate variable and function names to aid true understanding

This is a great project.

Just thinking, many of these koans can be solved by simply reading the english words, rather than actually understanding what's going on.

eg, you're touching on a powerful concept here

it("should use lexical scoping to synthesise functions", function () {

  function makeIncreaseByFunction(increaseByAmount)
  {
    var increaseByFunction = function increaseBy(numberToIncrease)
    {
      return numberToIncrease + increaseByAmount;
    };
    return increaseByFunction;
  }

  var increaseBy3 = makeIncreaseByFunction(3);
  var increaseBy5 = makeIncreaseByFunction(5);

  expect(increaseBy3(10) + increaseBy5(10)).toBe(FILL_ME_IN);
});

and yet it's trivially solved without even looking at what's actually going on; you only need to read the last line (!). Although highly desirable in a real world app, this doesn't help in learning how javascript works.

Can I suggest that if this project is truly about learning the ways of the javascripts, then all function and variable names should be obfuscated such that the only way to solve the problems is to understand the javascript logic, rather than just using your intuition/everyday logic.

edit: fixing up terminology

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.