Ad
juliocanaresFailed Tests

Bob

Bob is a lackadaisical teenager. In conversation, his responses are very limited.

Bob answers 'Sure.' if you ask him a question.

He answers 'Whoa, chill out!' if you yell at him.

He answers 'Calm down, I know what I'm doing!' if you yell a question at him.

He says 'Fine. Be that way!' if you address him without actually saying anything.

He answers 'Whatever.' to anything else.

Notes:

  1. Message with ALL UPPERCASES is consider yelling .
function hey(message) {
  var isAllUppercase = message === message.toUpperCase();
  var isYelling = message.includes("!") || isAllUppercase;
  var isQuestioning = message.includes("?");

  if (message.length === 0) {
    return "Fine. Be that way!";
  } else if (isQuestioning && isYelling) {
    return "Calm down, I know what I'm doing!";
  } else if (isQuestioning) {
    return "Sure.";
  } else if (isYelling) {
    return "Whoa, chill out!";
  } else {
    return "Whatever.";
  }
}