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

why is a cooking center appropriate for teaching science concepts? a. children can learn to read and write from recipes. b. children can observe that f
the hypotenuse of a right triangle is 3 cm and one of the legs is 1 cm what is the length of the other leg ?
What does the term heritage literacy means
Hurry !! Expand (2m+4) (m-3)
Please help X= 6 2/3 9 12
The parties have to depend largely on _____ for their campaign funding
how did the mayans use astronomy?
Select the correct answer. Which condition must be true for a nation to exist? A. All of the people must speak the same language. B. A single religion must unif
The class decides to make chocolate chip cookies for Ms. Zagars first day of school in September. Each student needs 3/4 of a stick of butter for the recipe. I
In an ecological pyramid, what information might be displayed about each trophic level? A. the relative amounts of energy B. the relative diversity C. the ty