Skip to content

Instantly share code, notes, and snippets.

let raceNumber = Math.floor(Math.random()*1000);
let earlyRegister = false;
let ageRunner = 18;
if (earlyRegister === true) {
console.log(`${raceNumber}`);
} else {
console.log(`${raceNumber} =+ 1000`);
}
let userName = '';
userName ? console.log(`Hello, ${userName}!`) : console.log('Hello!');
let userQuestion = 'Will it snow today?';
let randomNumber = Math.floor(Math.random() * 8);
let eightball = '';
switch(randomNumber) {
const getUserChoice = userInput => {
userInput = userInput.toLowerCase();
if (userInput === 'rock' || userInput === 'paper' || userInput === 'scissors' || userInput === 'bomb') {
return userInput;
} else {
console.log('error, the input is invalid.');
}
};
const getComputerChoice = () => {
const getSleepHours = day => {
if (day === 'Monday') {
return 8;
} else if (day === 'Tuesday') {
return 8;
} else if (day === 'Wednesday') {
return 7;
} else if (day === 'Thursday') {
return 7;
} else if (day === 'Friday') {