Stuck with these exercices

Hello,

I am new to coding and I am having trouble with these exercises. Cannot see the bug :thinking:
If someone has some free time to figure out what I did wrong that would be much appreciated!

Thanks

EXERCISE 1

const getUserChoice = (userInput) => {
userInput = userInput.toLowerCase();//To protect code so uniformed all lowe cases
if(userInput === ‘rock’ || userInput === ‘paper’ || userInput === ‘scissors’ || userInput == ‘bomb’){
return userInput;
}
else{
console.log(‘Error’)
}
};

const getComputerChoice = () =>{
const randomNumber = Math.floor(Math.random() * 3);
//Math.random = a decimal no between 0 and 1 now it can eith be 0, 1 or 2 with Math.floor
switch(randomNumber){
case 0:
return ‘rock’;
case 1:
return ‘paper’;
case 2:
return ‘scissors’;
}
}

const determineWinner = (userChoice, computerChoice) =>{
if(userChoice === ‘bomb’){
return ‘You destroyed your opponent. Congrats!’;
}
if(userChoice === computerChoice){
return ‘The game is a tie!’;
}

if(userChoice === ‘rock’){
if(compuerChoice === ‘paper’){
return ‘Computer won!’;
}
else{
return ‘User won!’;
}
}

if(userChoice === 'paper'){
if(compuerChoice === 'scissors'){
  return 'Computer won!';

}
else{
return ‘User won!’;
}
}

  if(userChoice === 'scissors'){
if(compuerChoice === 'rock'){
  return 'Computer won!';

}
else{
return ‘User won!’;
}
}

}

const playGame = () => {
const userChoice = getUserChoice(‘bomb’);
const computerChoice = getComputerChoice();
console.log(‘You choice is:’ + userChoice);
console.log(‘The computer choice is:’ + compuerChoice);
console.log(determineWinner(userChoice, computerChoice));
}
playGame();

EXERCISE 2

const getSleepHours = day => {

switch(day) {
    case 'monday;
    return 8
    break;
  case 'tuesday':
    return 7
    break;
  case 'wednesday':
    return 8
    break;
  case 'thursday':
    return 5
    break;
  case 'friday':
    return 8
    break;
  case 'saturday':
    return 7
    break;
  case sunday:
    return 8
    break;
    
  default:
    return 'Error'
    
    }

};

const getActualSleepHours = () =>
return getSleepHours(‘monday’) + getSleepHours(‘tuesday’) + getSleepHours(‘wednesday’) + getSleepHours(‘thursday’) + getSleepHours(‘friday’) + getSleepHours(‘saturday’) + getSleepHours(‘sunday’);

console.log(getSleepHours(‘monday’));
console.log(getActualSleepHours());

const getIdealSleepHours = () => {
let idealHours = 8;
return idealHours * 7;

};

const calculateSleepDebt = () => {
const actualSleepHours = getActualSleepHours();
const idealSleepHours = getIdealSleepHours();

if(actualSleepHours === idealSleepHours)
{
console.log(‘You got the perfect amount of sleep!’);

}

else if(actualSleepHours > idealSleepHours) {
console.log(‘You have got’ + idealSleepHours - actualSleepHour) ‘more hours of sleep this week.’);
}

else if(actualSleepHours < idealSleepHours) {
console.log(‘You should get some rest because you slept’ + (idealSleepHours - actualSleepHours) + ‘hours less than you should have this week.’);
}

else {
console.log(‘Error’);
}
};

calculateSleepDebt();

ge. if(userChoice === ‘scissors’){
if(compuerChoice === ‘rock’){
return ‘Computer won!’;
‘compuerChoice’ instead of ‘computerChoice’

case sunday:
return 8
break;

sunday must be around of apostrofes

Of note, break after return is unreachable. break may/should be removed from all the switch case statements.

Thanks y’all! :slight_smile: