Skip to content

Commit 2601677

Browse files
author
Tom Atkins
committed
2nd commit now I'm about a third of the way through
1 parent e6555ec commit 2601677

6 files changed

Lines changed: 24 additions & 25 deletions

File tree

jskoans.htm

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
<script type="text/javascript" src="topics/about_functions_and_closure.js"></script>
2323
<script type="text/javascript" src="topics/about_this.js"></script>
2424
<script type="text/javascript" src="topics/about_scope.js"></script>
25-
<script type="text/javascript" src="topics/about_regular_expressions.js"></script>
26-
27-
</head>
25+
<script type="text/javascript" src="topics/about_regular_expressions.js"></script>
26+
</head>
2827
<body>
2928
<h1 id="qunit-header">QUnit example</h1>
3029
<h2 id="qunit-banner"></h2>

topics/about_assignment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
module("About Assignment (topics/about_assignment.js)");
33

44
test("local variables", function() {
5-
var temp = __;
5+
var temp = 1;
66
equals(1, temp, "Assign a value to the variable temp");
77
});
88

99
test("global variables", function() {
1010
temp = 1;
11-
equals(temp, window.__, 'global variables are assigned to the window object');
11+
equals(temp, window.temp, 'global variables are assigned to the window object');
1212
});

topics/about_control_structures.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ test("if", function() {
55
if (2 > 0) {
66
isPositive = true;
77
}
8-
equals(isPositive, __, 'what is the value of isPositive?');
8+
equals(isPositive, true, 'what is the value of isPositive?');
99
});
1010

1111
test("for", function() {
1212
var counter = 10;
1313
for (var i = 1; i <= 3; i++) {
1414
counter = counter + i;
1515
}
16-
equals(counter, __, 'what is the value of counter?');
16+
equals(counter, 16, 'what is the value of counter?');
1717
});
1818

1919
test("for in", function() {
@@ -27,15 +27,15 @@ test("for in", function() {
2727
for (property_name in person) {
2828
result = result + property_name;
2929
};
30-
equals(result, __, 'what is the value of result?');
30+
equals(result, "nameage", 'what is the value of result?');
3131
});
3232

3333
test("ternary operator", function() {
3434
var fruit = true ? "apple" : "orange";
35-
equals(fruit, __, 'what is the value of fruit?');
35+
equals(fruit, "apple", 'what is the value of fruit?');
3636

3737
fruit = false ? "apple" : "orange";
38-
equals(fruit, __, 'now what is the value of fruit?');
38+
equals(fruit, "orange", 'now what is the value of fruit?');
3939
});
4040

4141
test("switch", function() {
@@ -48,7 +48,7 @@ test("switch", function() {
4848
result = 2;
4949
break;
5050
}
51-
equals(result, __, 'what is the value of result?');
51+
equals(result, 2, 'what is the value of result?');
5252
});
5353

5454
test("switch default case", function() {
@@ -64,10 +64,10 @@ test("switch default case", function() {
6464
result = "Merry";
6565
break;
6666
}
67-
equals(result, __, 'what is the value of result?');
67+
equals(result, "Merry", 'what is the value of result?');
6868
});
6969

7070
test("null coalescing", function() {
7171
var result = null || "a value";
72-
equals(result, __, 'what is the value of result?');
72+
equals(result, "a value", 'what is the value of result?');
7373
});

topics/about_equality.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
module("About Equality (topics/about_equality.js)");
33

44
test("numeric equality", function() {
5-
equals(3 + __, 7, 'hmmmm?');
5+
equals(3 + 4, 7, 'hmmmm?');
66
});
77

88
test("string equality", function() {
9-
equals("3" + __, "37", "concatenate the strings");
9+
equals("3" + "7", "37", "concatenate the strings");
1010
});
1111

1212
test("equality without type coercion", function() {
13-
ok(3 === __, 'what is exactly equal to 3?');
13+
ok(3 === 3, 'what is exactly equal to 3?');
1414
});
1515

1616
test("equality with type coercion", function() {
17-
ok(3 == "__", 'what string is equal to 3, with type coercion?');
17+
ok(3 == "3", 'what string is equal to 3, with type coercion?');
1818
});
1919

2020
test("string literals", function() {
21-
equals("frankenstein", '__', "quote types are interchangable, but must match.");
21+
equals("frankenstein", 'frankenstein', "quote types are interchangable, but must match.");
2222
});

topics/about_strings.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ module("About Strings (topics/about_strings.js)");
44
test("delimiters", function() {
55
var singleQuotedString = 'apple';
66
var doubleQuotedString = "apple";
7-
equals(singleQuotedString === doubleQuotedString, __, 'are the two strings equal?');
7+
equals(singleQuotedString === doubleQuotedString, true, 'are the two strings equal?');
88
});
99

1010
test("concatenation", function() {
1111
var fruit = "apple";
1212
var dish = "pie";
13-
equals(fruit + " " + dish, __, 'what is the value of fruit + " " + dish?');
13+
equals(fruit + " " + dish, "apple pie", 'what is the value of fruit + " " + dish?');
1414
});
1515

1616
test("character Type", function() {
1717
var characterType = typeof("Amory".charAt(1)); // typeof will be explained in about reflection
18-
equals(characterType, __, 'Javascript has no character type');
18+
equals(characterType, "string", 'Javascript has no character type');
1919
});
2020

2121
test("escape character", function() {

topics/about_truthyness.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ module("About Truthyness (topics/about_truthyness.js)");
33

44
test("truthyness of positive numbers", function() {
55
var oneIsTruthy = 1 ? true : false;
6-
equals(oneIsTruthy, __, 'is one truthy?');
6+
equals(oneIsTruthy, true, 'is one truthy?');
77
});
88

99
test("truthyness of negative numbers", function() {
1010
var negativeOneIsTruthy = -1 ? true : false;
11-
equals(negativeOneIsTruthy, __, 'is -1 truthy?');
11+
equals(negativeOneIsTruthy, true, 'is -1 truthy?');
1212
});
1313

1414
test("truthyness of zero", function() {
1515
var zeroIsTruthy = 0 ? true : false;
16-
equals(zeroIsTruthy, __, 'is 0 truthy?');
16+
equals(zeroIsTruthy, false, 'is 0 truthy?');
1717
});
1818

1919
test("truthyness of null", function() {
2020
var nullIsTruthy = null ? true : false;
21-
equals(nullIsTruthy, __, 'is null truthy?');
21+
equals(nullIsTruthy, false, 'is null truthy?');
2222
});

0 commit comments

Comments
 (0)