Skip to content
All challenges
ProgrammingPut in orderBeginner3 min

Build a discount

Skills: Control flow · Variables and scope

Task

These four lines make a working program that logs 70, but they are shuffled. Arrange them so each line only uses values that already exist. Use the buttons to move a line up or down.

Your answer

Put these in order, first to last

Use the buttons to move an item up or down. Your order is announced as you move.

  1. const discount = price > 50 ? 10 : 0; (Position 1 of 4)
  2. console.log(total); (Position 2 of 4)
  3. const total = price - discount; (Position 3 of 4)
  4. const price = 80; (Position 4 of 4)