From 09fa88d7b7d16a80f3a95f3212b2a34379e3e612 Mon Sep 17 00:00:00 2001 From: rbc33 Date: Mon, 1 Sep 2025 18:32:50 +0200 Subject: [PATCH 1/3] done --- .vscode/settings.json | 3 ++ index.js | 73 ++++++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 29 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..6f3a291 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "liveServer.settings.port": 5501 +} \ No newline at end of file diff --git a/index.js b/index.js index 294f6b2..7045115 100644 --- a/index.js +++ b/index.js @@ -1,76 +1,91 @@ /******************************************* Iteration 1.1 | Tongue Twister *******************************************/ -const s1 = "Fred"; -const s2 = "fed"; -const s3 = "Ted"; -const s4 = "bread"; -const s5 = "and"; +const s1 = 'Fred' +const s2 = 'fed' +const s3 = 'Ted' +const s4 = 'bread' +const s5 = 'and' // Concatenate the string variables into one new string +const newString = s1 + s2 + s3 + s4 + s5 // Print out the concatenated string - - +console.log(newString) /******************************************* Iteration 1.2 | Camel Tail *******************************************/ -const part1 = "java"; -const part2 = "script"; +const part1 = 'java' +const part2 = 'script' // Convert the last letter of part1 and part2 to uppercase and concatenate the strings +const part1Camel = + part1.slice(0, part1.length - 1) + part1[part1.length - 1].toUpperCase() +const part2Camel = + part2.slice(0, part2.length - 1) + part2[part2.length - 1].toUpperCase() +console.log('part1Camel: ', part1Camel) +const sentence = part1Camel + part2Camel // Print the cameLtaiL-formatted string - - - +console.log('sentence: ', sentence) /******************************************* Iteration 2.1 | Calculate Tip *******************************************/ -const billTotal = 84; +const billTotal = 84 // Calculate the tip (15% of the bill total) - +const tip = billTotal * 0.15 // Print out the tipAmount - - - +console.log('tip: ', tip) /******************************************* Iteration 2.2 | Generate Random Number *******************************************/ // Generate a random integer between 1 and 10 (inclusive) - +const randomNumber = Math.floor(Math.random() * 10) + 1 // Print the generated random number - - +console.log('randomNumber: ', randomNumber) /******************************************* Iteration 3.1 | Booleans *******************************************/ -const a = true; -const b = false; +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 +console.log('expresion1: ', false) +console.log('solution1: ', expression1) -const expression2 = a || b; +const expression2 = a || b +console.log('expresion2: ', true) +console.log('solution2: ', expression2) -const expression3 = !a && b; +const expression3 = !a && b +console.log('expresion3: ', false) +console.log('solution3: ', expression3) -const expression4 = !(a && b); +const expression4 = !(a && b) +console.log('expresion4: ', true) +console.log('solution4: ', expression4) -const expression5 = !a || !b; +const expression5 = !a || !b +console.log('expresion5: ', true) +console.log('solution5: ', expression5) -const expression6 = !(a || b); +const expression6 = !(a || b) +console.log('expresion6: ', false) +console.log('solution6: ', expression6) -const expression7 = a && a; \ No newline at end of file +const expression7 = a && a +console.log('expresion7: ', true) +console.log('solution7: ', expression7) From af19be92e0820ea5d8bb60a5811269a587adfd46 Mon Sep 17 00:00:00 2001 From: rbc33 Date: Tue, 2 Sep 2025 20:15:24 +0200 Subject: [PATCH 2/3] Solved lab --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 7045115..577ce5b 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ const s5 = 'and' // Concatenate the string variables into one new string -const newString = s1 + s2 + s3 + s4 + s5 +const newString = s1 + ' ' + s2 + ' ' + s3 + ' ' + s4 + ' ' + s5 // Print out the concatenated string From 11d1d5408ee2e39a2b933b92483273b0e6cdf0e6 Mon Sep 17 00:00:00 2001 From: rbc33 Date: Tue, 2 Sep 2025 20:18:58 +0200 Subject: [PATCH 3/3] Solved lab3 --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 577ce5b..010e674 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ const s5 = 'and' // Concatenate the string variables into one new string -const newString = s1 + ' ' + s2 + ' ' + s3 + ' ' + s4 + ' ' + s5 +const newString = `${s1} ${s2} ${s3} ${s4} ${s5} ${s3} ${s2} ${s1} ${s4}` // Print out the concatenated string