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: 31 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
// 2. Write a conditional that returns true if `votingAge` is 18 or older; otherwise, return false.
// 3. Log the result to the console.

// let votingAge = /* Your code here */;

// let votingAge = /* Your code here */;
let votingAge = 20;
console.log(votingAge >= 18);

/*🏋️‍♂️ Task 2: Variable Value Swap 🔄 */

Expand All @@ -17,7 +19,13 @@

// let variableOne = /* Your code here */;
// let variableTwo = /* Your code here */;
let variableOne = 5;
let variableTwo = 10;

if (variableTwo > 7) {
variableOne = 15;
}
console.log(variableOne);

/*🏋️‍♂️ Task 3: Favorite Number Checker 🔢 */

Expand All @@ -26,7 +34,15 @@
// 3. Log the result with a message, e.g., "My favorite number is greater than 10."

// let favoriteNumber = /* Your code here */;
let favoriteNumber = 7;

if (favoriteNumber > 10) {
console.log("My favorite number is greater than 10.");
} else if (favoriteNumber < 10) {
console.log("My favorite number is less than 10.");
} else {
console.log("My favorite number is equal to 10.");
}

/*🏋️‍♂️ Task 4: Mood Checker 😊😢 */

Expand All @@ -37,7 +53,15 @@
// - "So moody!" for any other input

// let mood = prompt("How are you feeling today?");
let mood = prompt("How are you feeling today?");

if (mood === "happy") {
console.log("Yay me too!");
} else if (mood === "sad") {
console.log("Aw, cheer up");
} else {
console.log("So moody!");
}

/*🏋️‍♂️ Task 5: Odd or Even Checker 🔍 */

Expand All @@ -46,7 +70,13 @@
// 3. Log whether the number is odd or even, along with the number, to the console.

// let num = /* Your code here */;
let num = 42;

if (num % 2 === 0) {
console.log(`${num} is even.`);
} else {
console.log(`${num} is odd.`);
}

/*🚀 FIZZBUZZ 🚀 */

Expand Down