diff --git a/README.md b/README.md index f71fcfcc..6a5de4ac 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ Update ====== -> If you like JavaScript Koans you might enjoy my newer, more user friendly, project [Didacto: JavaScript](http://javascript.didacto.net/) - JavaScript Koans is an interactive learning environment that uses failing tests to introduce students to aspects of JavaScript in a logical sequence. The inspiration for this project comes from the Edgecase Ruby Koans and the book 'Javascript: The Good Parts'. diff --git a/jskoans.htm b/jskoans.htm index a6bc4c00..f9427527 100644 --- a/jskoans.htm +++ b/jskoans.htm @@ -1,5 +1,5 @@ - + @@ -26,8 +26,7 @@ - - +

JavaScript Koans

diff --git a/support/koans.js b/support/koans.js index b367170c..4f11ea54 100644 --- a/support/koans.js +++ b/support/koans.js @@ -56,6 +56,7 @@ Array.prototype.equalTo = function(compareTo) { if (failures > 0) { $("#zen-help").show(); } + $("body").scrollTop($(document).height()); }); QUnit.log(function(result) { diff --git a/topics/about_arrays.js b/topics/about_arrays.js index 3d4cd41f..b2de2547 100644 --- a/topics/about_arrays.js +++ b/topics/about_arrays.js @@ -19,8 +19,10 @@ test("length", function() { test("splice", function() { var daysOfWeek = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; var workingWeek = daysOfWeek.splice(__, __); - ok(workingWeek.equalTo([__]), 'what is the value of workingWeek?'); - ok(daysOfWeek.equalTo([__]), 'what is the value of daysOfWeek?'); + var weekend = daysOfWeek; + + deepEqual(workingWeek, ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'], 'what is the value of workingWeek?'); + deepEqual(weekend, ['Saturday', 'Sunday'], 'what is the value of weekend?'); }); test("stack methods", function() { diff --git a/topics/about_functions_and_closure.js b/topics/about_functions_and_closure.js index d435c232..7477278f 100644 --- a/topics/about_functions_and_closure.js +++ b/topics/about_functions_and_closure.js @@ -3,7 +3,7 @@ module("About Functions And Closure (topics/about_functions_and_closure.js)"); test("defining functions directly", function() { var result = "a"; function changeResult() { - // the ability to access a variables defined in the same scope as the function is known as 'closure' + // the ability to access variables defined in the same scope as the function is known as 'closure' result = "b"; }; changeResult(); @@ -52,9 +52,9 @@ test("using call to invoke function",function(){ }; //another way to invoke a function is to use the call function which allows - //you to set the callers "this" context. Call can take any number of arguments: + //you to set the caller's "this" context. Call can take any number of arguments: //the first one is always the context that this should be set to in the called - //function, and the arguments to be sent to the function,multiple arguments are separated by commas. + //function, and the arguments to be sent to the function, multiple arguments are separated by commas. var result = invokee.call("I am this!", "Where did it come from?"); equal(__, result, "what will the value of invokee's this be?"); diff --git a/topics/about_reflection.js b/topics/about_reflection.js index 51e7c8ff..63868648 100644 --- a/topics/about_reflection.js +++ b/topics/about_reflection.js @@ -1,10 +1,10 @@ module("About Reflection (topics/about_reflection.js)"); -var A = function() { - this.aprop = "A"; +function A() { + this.aprop = "A"; }; -var B = function() { +function B() { this.bprop = "B"; }; @@ -14,7 +14,7 @@ test("typeof", function() { equal(__, typeof({}), 'what is the type of an empty object?'); equal(__, typeof('apple'), 'what is the type of a string?'); equal(__, typeof(-5), 'what is the type of -5?'); - equal(__, typeof(false), 'what is the type of false?'); + equal(__, typeof(false), 'what is the type of false?'); }); test("property enumeration", function() { @@ -40,7 +40,7 @@ test("hasOwnProperty", function() { equal(__, keys.length, 'how many elements are in the keys array?'); deepEqual([__, __], keys, 'what are the properties of the array?'); - // hasOwnProperty returns true if the parameter is a property directly on the object, + // hasOwnProperty returns true if the parameter is a property directly on the object, // but not if it is a property accessible via the prototype chain. var ownKeys = []; for(propertyName in b) { @@ -56,8 +56,8 @@ test("constructor property", function () { var a = new A(); var b = new B(); equal(__, typeof(a.constructor), "what is the type of a's constructor?"); - equal(__, a.constructor.name, "what is the name of a's constructor?"); - equal(__, b.constructor.name, "what is the name of b's constructor?"); + equal(__, a.constructor.name, "what is the name of a's constructor?"); + equal(__, b.constructor.name, "what is the name of b's constructor?"); }); test("eval", function() {