From e3d89ca40975e929c8ba046ed4bf723fbc9f0054 Mon Sep 17 00:00:00 2001 From: Andres Gonzalez Perez Date: Wed, 19 Nov 2025 14:45:27 +0100 Subject: [PATCH 1/2] lab done --- index.js | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index 294f6b2..d5a8881 100644 --- a/index.js +++ b/index.js @@ -9,9 +9,10 @@ const s5 = "and"; // Concatenate the string variables into one new string +const tongueTwister = `${s1} ${s2} ${s3} ${s5} ${s3} ${s2} ${s1}`; // Print out the concatenated string - +console.log(tongueTwister) @@ -23,9 +24,12 @@ const part2 = "script"; // Convert the last letter of part1 and part2 to uppercase and concatenate the strings +const result = (part1.slice(0) + part1[3].toUpperCase()) + (part2.slice(0) + part2[5].toUpperCase()); // Print the cameLtaiL-formatted string +console.log(result) + @@ -36,9 +40,12 @@ const billTotal = 84; // Calculate the tip (15% of the bill total) +const tipAmount = billTotal *15 / 100; // Print out the tipAmount +console.log(tipAmount) + @@ -48,9 +55,12 @@ const billTotal = 84; // Generate a random integer between 1 and 10 (inclusive) +const randomNumber = Math.floor(Math.random() * 11); // Print the generated random number +console.log(randomNumber) + /******************************************* @@ -61,16 +71,24 @@ const a = true; const b = false; // Try and guess the output of the below expressions first and write your answers down: -const expression1 = a && b; +const expression1 = a && b; // False + +const expression2 = a || b; // True -const expression2 = a || b; +const expression3 = !a && b; //False -const expression3 = !a && b; +const expression4 = !(a && b); //True -const expression4 = !(a && b); +const expression5 = !a || !b; // True -const expression5 = !a || !b; +const expression6 = !(a || b); // False -const expression6 = !(a || b); +const expression7 = a && a; // True -const expression7 = a && a; \ No newline at end of file +console.log(expression1); +console.log(expression2); +console.log(expression3); +console.log(expression4); +console.log(expression5); +console.log(expression6); +console.log(expression7); \ No newline at end of file From 7619210441bfc4b88ba4c35abc942039214c62df Mon Sep 17 00:00:00 2001 From: Andres Gonzalez Perez Date: Wed, 19 Nov 2025 15:03:43 +0100 Subject: [PATCH 2/2] lad re-done with corrections --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index d5a8881..529fbf9 100644 --- a/index.js +++ b/index.js @@ -55,7 +55,7 @@ console.log(tipAmount) // Generate a random integer between 1 and 10 (inclusive) -const randomNumber = Math.floor(Math.random() * 11); +const randomNumber = Math.floor(Math.random() * 10) +1; // Print the generated random number