Skip to content

Commit dc9f9e7

Browse files
committed
Replace var with let in some exercise solutions
Issue marijnh#277
1 parent 3baa71e commit dc9f9e7

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

code/solutions/08_2_the_locked_box.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
function withBoxUnlocked(body) {
2-
var locked = box.locked;
2+
let locked = box.locked;
33
if (!locked) {
44
return body();
55
}

code/solutions/18_3_conways_game_of_life.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
// x,y position, counting all fields that have a cell but are not the
4343
// center field.
4444
function countNeighbors(grid, x, y) {
45-
var count = 0;
45+
let count = 0;
4646
for (let y1 = Math.max(0, y - 1); y1 <= Math.min(height - 1, y + 1); y1++) {
4747
for (let x1 = Math.max(0, x - 1); x1 <= Math.min(width - 1, x + 1); x1++) {
4848
if ((x1 != x || y1 != y) && grid[x1 + y1 * width]) {

code/solutions/21_1_disk_persistence.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const {readFileSync, writeFile} = require("fs");
66
const fileName = "./talks.json";
77

88
function loadTalks() {
9-
var json;
9+
let json;
1010
try {
1111
json = JSON.parse(readFileSync(fileName, "utf8"));
1212
} catch (e) {

0 commit comments

Comments
 (0)