From 3e11588b2e6f7a7f9fd616c152c65962893cfa0a Mon Sep 17 00:00:00 2001 From: Eric Wagoner Date: Mon, 1 Dec 2025 11:06:33 -0500 Subject: [PATCH] Tweak templates --- 02/code.js | 12 +++++------- 03/code.js | 12 +++++------- day-template/code.js | 12 +++++------- package.json | 3 +++ 4 files changed, 18 insertions(+), 21 deletions(-) create mode 100644 package.json diff --git a/02/code.js b/02/code.js index 83a61e0..f8ea725 100644 --- a/02/code.js +++ b/02/code.js @@ -1,12 +1,12 @@ import { readFileSync } from 'node:fs'; const inputArray = readFileSync('sample.txt').toString().split("\n"); -// const inputArray = fs.readFileSync('input.txt').toString().split("\n"); +// const inputArray = readFileSync('input.txt').toString().split("\n"); // Part One -for (i in inputArray) { - const contents = inputArray[i].split(" "); +for (const element of inputArray) { + const contents = element.split(" "); } @@ -15,13 +15,11 @@ console.log(); // Part Two -for (i in inputArray) { - const contents = inputArray[i].split(" "); +for (const element of inputArray) { + const contents = element.split(" "); } - console.log(); // functions - diff --git a/03/code.js b/03/code.js index 83a61e0..f8ea725 100644 --- a/03/code.js +++ b/03/code.js @@ -1,12 +1,12 @@ import { readFileSync } from 'node:fs'; const inputArray = readFileSync('sample.txt').toString().split("\n"); -// const inputArray = fs.readFileSync('input.txt').toString().split("\n"); +// const inputArray = readFileSync('input.txt').toString().split("\n"); // Part One -for (i in inputArray) { - const contents = inputArray[i].split(" "); +for (const element of inputArray) { + const contents = element.split(" "); } @@ -15,13 +15,11 @@ console.log(); // Part Two -for (i in inputArray) { - const contents = inputArray[i].split(" "); +for (const element of inputArray) { + const contents = element.split(" "); } - console.log(); // functions - diff --git a/day-template/code.js b/day-template/code.js index 83a61e0..f8ea725 100644 --- a/day-template/code.js +++ b/day-template/code.js @@ -1,12 +1,12 @@ import { readFileSync } from 'node:fs'; const inputArray = readFileSync('sample.txt').toString().split("\n"); -// const inputArray = fs.readFileSync('input.txt').toString().split("\n"); +// const inputArray = readFileSync('input.txt').toString().split("\n"); // Part One -for (i in inputArray) { - const contents = inputArray[i].split(" "); +for (const element of inputArray) { + const contents = element.split(" "); } @@ -15,13 +15,11 @@ console.log(); // Part Two -for (i in inputArray) { - const contents = inputArray[i].split(" "); +for (const element of inputArray) { + const contents = element.split(" "); } - console.log(); // functions - diff --git a/package.json b/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +}