From c396947a9c6cd570f13e1beb3974423b28160be9 Mon Sep 17 00:00:00 2001
From: gusdev <59888502+Gus2708@users.noreply.github.com>
Date: Thu, 18 Dec 2025 02:01:22 +0000
Subject: [PATCH 1/3] Optimized and organized code: - Fixed indentation issues
in JavaScript - Used template literal for the `excuse` variable to
interpolate multiple expressions - Improved HTML styles with clearer spacing
using Bootstrap
---
index.html | 19 +++++++++++++++++--
script.js | 15 ++++++++-------
2 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/index.html b/index.html
index 7322f8b..03341d4 100644
--- a/index.html
+++ b/index.html
@@ -3,11 +3,26 @@
+
Excuse generator
- Excuse Generator
- My dog ate my homework
+
+
+
+
+
+
+
+
My dog ate my homework
+
+
+
+
diff --git a/script.js b/script.js
index 6b41f4a..5730f35 100644
--- a/script.js
+++ b/script.js
@@ -4,14 +4,15 @@ let what = ['my homework', 'my phone', 'the car'];
let when = ['before the class', 'when I was sleeping', 'while I was exercising', 'during my lunch', 'while I was praying'];
function generateExcuse() {
-let whoRandom = who[Math.floor(Math.random() * who.length)];
-let actionRandom = action[Math.floor(Math.random() * action.length)];
-let whatRandom = what[Math.floor(Math.random() * what.length)];
-let whenRandom = when[Math.floor(Math.random() * when.length)];
+ let whoRandom = who[Math.floor(Math.random() * who.length)];
+ let actionRandom = action[Math.floor(Math.random() * action.length)];
+ let whatRandom = what[Math.floor(Math.random() * what.length)];
+ let whenRandom = when[Math.floor(Math.random() * when.length)];
-let excuse = whoRandom + ' ' + actionRandom + ' ' + whatRandom + ' ' + whenRandom;
-return excuse;
-}
+ let excuse = `${whoRandom} ${actionRandom} ${whatRandom} ${whenRandom}`;
+
+ return excuse;
+};
window.onload = function () {
document.getElementById("excuse").innerHTML = generateExcuse();
From babcf7916b9096539d2308463f23d13c27973beb Mon Sep 17 00:00:00 2001
From: Edupe2603 <31553111+Edupe2603@users.noreply.github.com>
Date: Thu, 18 Dec 2025 03:14:15 +0000
Subject: [PATCH 2/3] Se agrega un texto decorativo. Tambien se cambia el color
de la excusa y se le agrega un borde
---
index.html | 3 ++-
package-lock.json | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
create mode 100644 package-lock.json
diff --git a/index.html b/index.html
index 03341d4..f9a0f79 100644
--- a/index.html
+++ b/index.html
@@ -13,12 +13,13 @@
Excuse Generator
+ You will not believe me, but...
-
My dog ate my homework
+
My dog ate my homework
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..9c3df9a
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,6 @@
+{
+ "name": "Excuse-generator-PR",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {}
+}
From 5eda48aac4fc058227be77ffd3b8e742e3f285f7 Mon Sep 17 00:00:00 2001
From: gusdev <59888502+Gus2708@users.noreply.github.com>
Date: Thu, 18 Dec 2025 03:41:31 +0000
Subject: [PATCH 3/3] adding randomSelector function to reuse in generateExcuse
function
---
package-lock.json | 2 +-
script.js | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 9c3df9a..7ebd9e8 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,5 +1,5 @@
{
- "name": "Excuse-generator-PR",
+ "name": "Excuse-generator",
"lockfileVersion": 3,
"requires": true,
"packages": {}
diff --git a/script.js b/script.js
index 5730f35..ed1f53f 100644
--- a/script.js
+++ b/script.js
@@ -3,11 +3,15 @@ let action = ['ate', 'peed', 'crushed', 'broke'];
let what = ['my homework', 'my phone', 'the car'];
let when = ['before the class', 'when I was sleeping', 'while I was exercising', 'during my lunch', 'while I was praying'];
+function randomSelector ( array ) {
+ return array[Math.floor(Math.random() * array.length)];
+};
+
function generateExcuse() {
- let whoRandom = who[Math.floor(Math.random() * who.length)];
- let actionRandom = action[Math.floor(Math.random() * action.length)];
- let whatRandom = what[Math.floor(Math.random() * what.length)];
- let whenRandom = when[Math.floor(Math.random() * when.length)];
+ let whoRandom = randomSelector( who );
+ let actionRandom = randomSelector( action );
+ let whatRandom = randomSelector( what );
+ let whenRandom = randomSelector( when );
let excuse = `${whoRandom} ${actionRandom} ${whatRandom} ${whenRandom}`;