The Code Uses Nested Loops and The the Missing Code Question
Description
Question 1:
The following code uses nested loops and “document.write” to output the following triangle:
#
##
###
####
#####
######
#######
What is the missing code (indicated by the underscore __ ) in the program below that would make this program function as described?
for(var x=7;x__;x__){for(var y=i;y__;y__){document.write("#");}
document.write("<br>");}
Question 2
- Prompt the user for a name that is at least 5 characters long.
- Call a function that can accept the name that the user entered.
- In the function, change the case of the letters so that the first letter is lower case and the next letter is Uppercase and so on (i.e. eXaMpLe) and return the new value to the function call.
- Output to the console “Hi <username>, how do you like when I write you name like this: <new user name>”? (replace <username> and <new user name> with the proper values).
Question 3
Here are the rules:
- The dealer is assigned a random number between 2 and 21
- The player is given a random number between 1 and 11.
- The user can request another number, it is then added to their original value.
- If the value is under 21, the user can ask for another number (y) OR stay (n).
- If the player’s amount is over 21, they lose.
- Once they stay, the players’ amount and the dealer’s amount are compared.
- Whomever has the higher amount wins, if they are equal, it’s a tie.
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."