isaiahcannon4113 isaiahcannon4113
  • 25-11-2020
  • Computers and Technology
contestada

Write an if-else statement for the following: If user_tickets is less than 5, assign 1 to num_tickets. Else, assign user_tickets to num_tickets

Respuesta :

AbsorbingMan AbsorbingMan
  • 25-11-2020

Solution :

function tickets(user_tickets){

var num_tickets;

if (user_tickets < 5) {

num_tickets = 1;

return ('num_tickets: '+ num_tickets);

}

else {

num_tickets = user_tickets;

 return('num_tickets: '+ num_tickets);

}

}

// Testing the tickets function

// With user_tickets = 3, 5, 8, and 1

console.log(tickets(3));

console.log(tickets(5));

console.log(tickets(8));

console.log(tickets(1));

Answer Link

Otras preguntas

A very flammable substance would not be used in children’s clothing? true or false
Please help. Is it possible to construct a triangle with sides 4, 5, 9 if not explain why.
Ella no entendie lo que dices. A. Incorrecta B. Correcta
Who proposed the Albany Plan of Union and what was the purpose?
sally spent $36 and had $12 left . what percent of her money did she spend
The table shows the dimensions of 4 different rectangles. Each rectangle has an area of 24 square centimeters. Which rectangle has an area of 24 square centim
Is the act of taking property from another person through force, threat of force, or intimidation?
Joey pays $672 per year in insurance, how mush should he budget monthly for it? A. $112, B. $84 C. $56, D. $28 The equation y = 1.55x + 110,419 approximates t
What legal tools did the Roman republic use to unhold the rule of law
What expression shows the relationship between the value term n