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

What is the sin, cos, and tan of -495 degrees, and -20π/3  ??
Are the light waves reflecting off a red stop sign longer or shorter than the waves reflecting off a Violet colored jacket
How did geography affect the development of Greek Civilization?
140% of what number is 56
what is the meaning of The superior man loves quality; the small man loves comfort
How did geography affect the development of Greek Civilization?
You have had a class discussion on the following question:What are the pros and cons of keeping fit ? Now your teacher has asked you to write a composition on t
Answer to this question please ASAP
what is the meaning of The superior man loves quality; the small man loves comfort
Which of the following organic compounds is the main source of energy for living things?a.carbohydratesc.nucleic acidsb.lipidsd.proteins