Skip to content
Open
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
32 changes: 28 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
/*******************************************
Iteration 1.1 | Tongue Twister
*******************************************/


const s1 = "Fred";
const s2 = "fed";
const s3 = "Ted";
const s4 = "bread";
const s5 = "and";
let tongueTwister;
tongueTwister=s1+` `+s2+` `+s3+` `+s4+` `+s5+` `+s4+` `+s3+` `+s2+` `+s1;

console.log(tongueTwister);

// Concatenate the string variables into one new string

Expand All @@ -20,7 +26,10 @@ const s5 = "and";
*******************************************/
const part1 = "java";
const part2 = "script";

let chr1=part1[part1.length-1].toUpperCase();
let chr2=part2[part2.length-1].toUpperCase();
let final=part1.slice(0,part1.length-1)+chr1+part2.slice(0,part2.length-1)+chr2;
console.log(final)
// Convert the last letter of part1 and part2 to uppercase and concatenate the strings


Expand All @@ -33,6 +42,8 @@ const part2 = "script";
Iteration 2.1 | Calculate Tip
*******************************************/
const billTotal = 84;
let tipAmount=billTotal*0.15;
console.log(tipAmount)

// Calculate the tip (15% of the bill total)

Expand All @@ -45,10 +56,12 @@ const billTotal = 84;
/*******************************************
Iteration 2.2 | Generate Random Number
*******************************************/


let N=10;
// Generate a random integer between 1 and 10 (inclusive)


let randomNumber=Math.floor(Math.random()*(N+1));
console.log(randomNumber);
// Print the generated random number


Expand All @@ -62,15 +75,26 @@ const b = false;

// Try and guess the output of the below expressions first and write your answers down:
const expression1 = a && b;
//false

const expression2 = a || b;
//true

const expression3 = !a && b;
//false

const expression4 = !(a && b);
//true

const expression5 = !a || !b;
//true


const expression6 = !(a || b);
//false


const expression7 = a && a;
//true

const expression7 = a && a;
console.log(expression1,expression2,expression3,expression4,expression5,expression6,expression7)