From 1c26f6c7cfcc1c4d1a3ed411b9fecec4a46a5132 Mon Sep 17 00:00:00 2001 From: FaayPi Date: Fri, 11 Jul 2025 11:16:31 +0200 Subject: [PATCH] lab js data types --- index.html | 20 +++++++------- index.js | 76 ------------------------------------------------------ script.js | 63 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 86 deletions(-) delete mode 100644 index.js create mode 100644 script.js diff --git a/index.html b/index.html index 53e29ed..3c88aa0 100644 --- a/index.html +++ b/index.html @@ -1,16 +1,16 @@ - + - - - LAB | JS Data Types + + lab-js-data-types + + -

LAB | JS Data Types

-
-
-

Open the Dev Tools console to see the console output.

+ + + + - - \ No newline at end of file + diff --git a/index.js b/index.js deleted file mode 100644 index 294f6b2..0000000 --- a/index.js +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************* - Iteration 1.1 | Tongue Twister -*******************************************/ -const s1 = "Fred"; -const s2 = "fed"; -const s3 = "Ted"; -const s4 = "bread"; -const s5 = "and"; - -// Concatenate the string variables into one new string - - -// Print out the concatenated string - - - - -/******************************************* - Iteration 1.2 | Camel Tail -*******************************************/ -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 - - - - -/******************************************* - Iteration 2.1 | Calculate Tip -*******************************************/ -const billTotal = 84; - -// Calculate the tip (15% of the bill total) - - -// Print out the tipAmount - - - - -/******************************************* - Iteration 2.2 | Generate Random Number -*******************************************/ - -// Generate a random integer between 1 and 10 (inclusive) - - -// Print the generated random number - - - -/******************************************* - Iteration 3.1 | Booleans -*******************************************/ - -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 expression2 = a || b; - -const expression3 = !a && b; - -const expression4 = !(a && b); - -const expression5 = !a || !b; - -const expression6 = !(a || b); - -const expression7 = a && a; \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..3be1661 --- /dev/null +++ b/script.js @@ -0,0 +1,63 @@ +// Iteration 1 +const s1 = "Fred"; +const s2 = "fed"; +const s3 = "Ted"; +const s4 = "bread"; +const s5 = "and"; + +const text = `${s1} ${s2} ${s3} ${s5} ${s3} ${s2} ${s1} ${s4}`; +// "Fred fed Ted bread and Ted fed Fred bread". + +console.log(text); + +// Itertation 2 +const part1 = "java"; +const part2 = "script"; + +const part1new = part1.slice(0,-1) + part1.slice(-1).toUpperCase() + +const part2new = part2.slice(0,-1) + part2.slice(-1).toUpperCase() + +const cameLCase = part1new + part2new + +console.log(cameLCase) + +// Itration 3 + +const billTotal = 84; + +const tipAmount = billTotal * 0.15 + +console.log(tipAmount) + +// Iteration 4 +const max = 10 +const randomNumber = Math.floor(Math.random() * max) + +console.log(randomNumber) + +// Iteration 5 +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; // false +console.log(expression1) + +const expression2 = a || b; // true +console.log(expression2) + +const expression3 = !a && b; // false +console.log(expression3) + +const expression4 = !(a && b); // true +console.log(expression4) + +const expression5 = !a || !b; // true +console.log(expression5) + +const expression6 = !(a || b); // false +console.log(expression6) + +const expression7 = a && a; // true +console.log(expression7) \ No newline at end of file