This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let raceNumber = Math.floor(Math.random()*1000); | |
let earlyRegister = false; | |
let ageRunner = 18; | |
if (earlyRegister === true) { | |
console.log(`${raceNumber}`); | |
} else { | |
console.log(`${raceNumber} =+ 1000`); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') { |