Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<body>
<h1>LAB | JS Data Types</h1>
<br />
<p style="font-size: 30px;" id="demo"></p>
<p style="font-size: 30px;" id="demo1"></p>
<p style="font-size: 30px;" id="demo2"></p>
<br />
<p> Open the <a href="https://developer.chrome.com/docs/devtools/open/">Dev Tools console</a> to see the console output.</p>

Expand Down
28 changes: 26 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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)

Expand All @@ -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
Expand All @@ -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;
const expression7 = a && a;
console.log(expression7);