Two questions - Code your own Adventure


Please help me write a code that satisfies the following conditions:
1. During User Response to "Do you want to race Bieber on stage?",response should be case insensitive. That is Yes, yes, or yEs should be acceptable.
I tried the following code with no luck!
if (userAnswer === "Yes" | "yes")
2. While receiving the Rating response from the user, how to ensure that the response is a number and that too less than or equal to 10?


Here are some hints:

  1. Case doesn't matter. So, "yes", "YES", "yEs", "YeS" etc. can be changed to some other case. That is user input's case can be changed to either lower or upper. You must be knowing of the two built-in methods that let you do this. Change the user's input's case, and compare it with "YES" or "yes" depending on whether you changed the case to upper or lower respectively.
  2. typeof operator generates a string that will help you identify whether it's a number of any other type. Example, typeof true gives "boolean". typeof 3 gives "number". Also, for the second part ("less than or equal to 10") you have to use a relational operator. Construct an if condition using both these two parts.

Hope it helps!




google search
== the Book ==
javascript [your question]

== discussions / opinions ==
javascript [your question]

== guidance ==


Thanks for your help - I got the required info that is required to satisfy my conditions!