diff --git a/index.html b/index.html index 53e29ed..b3f0fdb 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,9 @@
Open the Dev Tools console to see the console output.
diff --git a/index.js b/index.js index 294f6b2..e88251d 100644 --- a/index.js +++ b/index.js @@ -6,9 +6,12 @@ const s2 = "fed"; const s3 = "Ted"; const s4 = "bread"; const s5 = "and"; +let tongueTwister = s1+' '+s2+' '+s3+' '+s4+' '+s5+' '+s3+' '+s2+' '+s1+' '+s4; // Concatenate the string variables into one new string - +console.log(tongueTwister); +console.log(typeof tongueTwister); +document.getElementById('demo').innerHTML = tongueTwister; // Print out the concatenated string @@ -22,6 +25,12 @@ const part1 = "java"; const part2 = "script"; // Convert the last letter of part1 and part2 to uppercase and concatenate the strings +let letterA = part1.slice(3); +let result = part1.slice(0,-1)+letterA.toUpperCase()+part2.slice(0,-1)+part2.slice(5).toUpperCase(); + + +document.getElementById('demo1').innerHTML = result; +console.log(result); // Print the cameLtaiL-formatted string @@ -33,6 +42,10 @@ const part2 = "script"; Iteration 2.1 | Calculate Tip *******************************************/ const billTotal = 84; +let tipAmount = billTotal*0.15+'$'; +console.log(tipAmount); +document.getElementById('demo2').innerHTML = tipAmount; + // Calculate the tip (15% of the bill total) @@ -47,6 +60,10 @@ const billTotal = 84; *******************************************/ // Generate a random integer between 1 and 10 (inclusive) +let numberRandom; +numberRandom =Math.floor(Math.random()*11) +console.log(numberRandom) +document.getElementById('demo2').innerHTML = numberRandom; // Print the generated random number @@ -62,15 +79,22 @@ const b = false; // Try and guess the output of the below expressions first and write your answers down: const expression1 = a && b; +console.log(expression1); const expression2 = a || b; +console.log(expression2); const expression3 = !a && b; +console.log(expression3); const expression4 = !(a && b); +console.log(expression4); const expression5 = !a || !b; +console.log(expression5); const expression6 = !(a || b); +console.log(expression6); -const expression7 = a && a; \ No newline at end of file +const expression7 = a && a; +console.log(expression7); \ No newline at end of file