Question: Given the following code - Update the condition to incorporate the .toUpperCase method === 'RUBY' this way, it doesn't matter if the user enters the

Given the following code - Update the condition to incorporate the .toUpperCase method === 'RUBY' this way, it doesn't matter if the user enters the answer in lowercase,the condition is passed since the answer is converted to upper case letters; therfore matching the string

// obtain a response from the user let answer = prompt('What programming language is the name of a gem?');

//just like let is used to declare variables, the let keyword is user for // a conditional statement

if ( answer === 'Ruby' )

//inside the parenthesis is the condition just // a simple test whose answer is either true or false in this example // the given answer must match exactly

// inside the braces is the code that runs only if the statement is true { document.write("

You are right, good thinking !

") //indenting the code mades it easier to read }

else { //this block of code will run only if the answer if NOT Ruby document.write("

Darn, your answer if not right!

") }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!