Notice how the all of the variable declarations have been pushed up to
the top of the closest scope, the first time they appear.
- num is not redeclared within the inner function, because it's
- already in scope; the new_num within the function, on the other hand,
+ outer is not redeclared within the inner function, because it's
+ already in scope; inner within the function, on the other hand,
should not be able to change the value of the external variable of the same name, and
therefore has a declaration of its own.
diff --git a/documentation/js/classes.js b/documentation/js/classes.js
index 1f5ca1dd..a4fccd95 100644
--- a/documentation/js/classes.js
+++ b/documentation/js/classes.js
@@ -3,11 +3,12 @@
var __extends = function(child, parent) {
var ctor = function(){ };
ctor.prototype = parent.prototype;
- child.__superClass__ = parent.prototype;
child.prototype = new ctor();
child.prototype.constructor = child;
+ if (typeof parent.extended === "function") parent.extended(child);
+ child.__superClass__ = parent.prototype;
};
- Animal = function() { };
+ Animal = function() {};
Animal.prototype.move = function(meters) {
return alert(this.name + " moved " + meters + "m.");
};
diff --git a/documentation/js/range_comprehensions.js b/documentation/js/range_comprehensions.js
index dfcca44e..e7b2cc30 100644
--- a/documentation/js/range_comprehensions.js
+++ b/documentation/js/range_comprehensions.js
@@ -2,16 +2,15 @@
var _a, countdown, deliverEggs, num;
countdown = (function() {
_a = [];
- for (num = 10; num >= 1; num += -1) {
+ for (num = 10; num >= 1; num--) {
_a.push(num);
}
return _a;
})();
deliverEggs = function() {
var _b, _c, dozen, i;
- _b = []; (_c = eggs.length);
-
- for (i = 0; i < _c; i += 12) {
+ _b = []; _c = eggs.length;
+ for (i = 0; (0 <= _c ? i < _c : i > _c); i += 12) {
_b.push((function() {
dozen = eggs.slice(i, i + 12);
return deliver(new eggCarton(dozen));
diff --git a/index.html b/index.html
index d70c57b2..14ae5c9f 100644
--- a/index.html
+++ b/index.html
@@ -570,8 +570,8 @@ inner = changeNumbers();
Notice how the all of the variable declarations have been pushed up to
the top of the closest scope, the first time they appear.
- num is not redeclared within the inner function, because it's
- already in scope; the new_num within the function, on the other hand,
+ outer is not redeclared within the inner function, because it's
+ already in scope; inner within the function, on the other hand,
should not be able to change the value of the external variable of the same name, and
therefore has a declaration of its own.
@@ -877,7 +877,7 @@ _f = asteroids;
in fixed-size increments, you can use a range to specify the start and
end of your comprehension.
-
countdown: num for num in [10..1] by-1
+
countdown: num for num in [10..1]
deliverEggs:->for i in [0...eggs.length] by12
@@ -886,16 +886,15 @@ _f = asteroids;
var _a, countdown, deliverEggs, num;
countdown = (function() {
_a = [];
- for (num =10; num >=1; num +=-1) {
+ for (num =10; num >=1; num--) {
_a.push(num);
}
return _a;
})();
deliverEggs = function() {
var _b, _c, dozen, i;
- _b = []; (_c = eggs.length);
-
- for (i =0; i < _c; i +=12) {
+ _b = []; _c = eggs.length;
+ for (i =0; (0<= _c ? i < _c : i > _c); i +=12) {
_b.push((function() {
dozen = eggs.slice(i, i +12);
return deliver(neweggCarton(dozen));
@@ -906,16 +905,15 @@ countdown = (function(