diff --git a/index.js b/index.js index 294f6b2..5d531d4 100644 --- a/index.js +++ b/index.js @@ -8,10 +8,10 @@ const s4 = "bread"; const s5 = "and"; // Concatenate the string variables into one new string - +const concatSN = s1 + " " + s2 + " " + s3 + " " + s4 + " " + s5; // Print out the concatenated string - +console.log(concatSN); @@ -22,12 +22,16 @@ const part1 = "java"; const part2 = "script"; // Convert the last letter of part1 and part2 to uppercase and concatenate the strings - +const convertP1 = part1.slice(0, 3) + part1.charAt(3).toUpperCase(); +// console.log(convertP1); +const convertP2 = part2.slice(0, 5) + part2.charAt(5).toUpperCase(); +// console.log(convertP2); // Print the cameLtaiL-formatted string +const convP1P2 = convertP1 + convertP2; +console.log(convP1P2); - - + /******************************************* Iteration 2.1 | Calculate Tip @@ -35,10 +39,10 @@ const part2 = "script"; const billTotal = 84; // Calculate the tip (15% of the bill total) - +const tipTot = billTotal * 0.15; // Print out the tipAmount - +console.log(tipTot); @@ -47,9 +51,10 @@ const billTotal = 84; *******************************************/ // Generate a random integer between 1 and 10 (inclusive) - +const randomInt = Math.floor(Math.random() * 10) + 1; // Print the generated random number +console.log(randomInt); @@ -62,15 +67,29 @@ 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; \ No newline at end of file +const expression7 = a && a; +// True +console.log(expression7); \ No newline at end of file