html Debugging Challenges: Conditional Statements of Fate

Debugging Challenges: Conditional Statements of Fate

Will you be the chosen one, destined to wield the power of debugging? Or will you succumb to the darkness of infinite loops?

Challenge 1: The If-Then Conundrum

Write a program that outputs "I'm a winner!" if the user's age is 18 or above, and "Practice makes perfect!" if the user's age is under 18.

if (age > 18) {
				console.log('I\'m a winner!');
			} else {
				console.log('Practice makes perfect!');
			}
See Solution 1

Challenge 2: The Ternary Tragedy

Write a program that outputs "True" if the user's age is 25 or above, and "False" if not.

const age = 25;
			if (age > 25) {
				console.log(true);
			} else {
				console.log(false);
			}
See Solution 2

Challenge 3: The Switch Statement of Doom

Write a program that outputs "I'm a winner!" if the user scores 100 or above, and "Game Over" if they score 100 or below.

if (score > 100) {
				console.log('I\'m a winner!');
			} else {
				console.log('Game Over');
			}
See Solution 3

Or, if you're feeling adventurous, try the Ternary Terror challenge!