From c33b60b10b246ccfb2bdfca690680a16656b56c0 Mon Sep 17 00:00:00 2001 From: Victor Mosqueda Date: Wed, 19 Nov 2025 14:25:46 +0000 Subject: [PATCH] solved lab --- index.js | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/index.js b/index.js index 294f6b2..3aca348 100644 --- a/index.js +++ b/index.js @@ -7,13 +7,13 @@ const s3 = "Ted"; const s4 = "bread"; const s5 = "and"; -// Concatenate the string variables into one new string - - -// Print out the concatenated string +let tongueTwister = [`${s1} ${s2} ${s3} ${s4} ${s5} ${s3} ${s2} ${s1} ${s4}`]; +console.log(tongueTwister); +// Concatenate the string variables into one new string +// Print out the concatenated string /******************************************* Iteration 1.2 | Camel Tail @@ -21,38 +21,35 @@ const s5 = "and"; const part1 = "java"; const part2 = "script"; -// Convert the last letter of part1 and part2 to uppercase and concatenate the strings - - -// Print the cameLtaiL-formatted string +let result1 = part1.slice(0, 3) + part1.slice(-1).toUpperCase(); +let result2 = part2.slice(0, 5) + part2.slice(-1).toUpperCase(); +console.log(`${result1}${result2}`); +// Convert the last letter of part1 and part2 to uppercase and concatenate the strings +// Print the cameLtaiL-formatted string /******************************************* Iteration 2.1 | Calculate Tip *******************************************/ const billTotal = 84; +console.log(billTotal * 0.15); // Calculate the tip (15% of the bill total) - // Print out the tipAmount - - - /******************************************* Iteration 2.2 | Generate Random Number *******************************************/ +let randomNumber = Math.random() * 10; +console.log(Math.floor(randomNumber + 1)); // Generate a random integer between 1 and 10 (inclusive) - // Print the generated random number - - /******************************************* Iteration 3.1 | Booleans *******************************************/ @@ -73,4 +70,4 @@ const expression5 = !a || !b; const expression6 = !(a || b); -const expression7 = a && a; \ No newline at end of file +const expression7 = a && a;