04.05 · Numbers / Practice · 8 min
Total two diner orders
The diner has three prices and two different orders. Make the same named prices work for both customers.
Activity 5 of 8 in Numbers
JavaScript Basics / 04.05
Total two diner orders
Not started
Complete the original burger, fries and milkshake assignment with named prices and two customer totals.
Your lesson progress
Empty: not started. Yellow: in progress. Green: complete. Marking the whole activity complete does not replace your test results. These circles save in this browser for this pilot.

Calculate both diner orders from named prices
Work through 3 focused steps. Read the explanation, type each requested change and check it before moving on. Your own code carries forward.
The mini-lesson opens in a new tab. Your own code carries forward; each step has a focused check and an optional hint.
Start mini-lesson(opens in a new tab)3 steps · Saved work · Instant feedback
YOUR TURN
Total two diner orders
Use the original prices: hamburger 2.85, fries 2.15, milkshake 2.45. Customer 1 orders one of each. Customer 2 orders three burgers and one milkshake. Fix both totals using the named prices, then print customer1Total and customer2Total in that order. Expected output: 7.45 and 11.
7.45 11
Keep the starting inputs. Print these lines in this order, without extra output.
Edit JavaScript, then run it. Check Challenge shows which output checks pass or need a fix. Word wrap is enabled.
Ready to checkRun the checks to see your results here.
Your check results
Work in VS Code instead
Copy the starter into a file named practice.js in VS Code. If Node.js is installed, open the terminal in that folder and run node practice.js. Compare the output with the task above. Automated challenge checks are available in the browser editor.
const hamburger = 2.85;
const fries = 2.15;
const milkshake = 2.45;
let customer1Total = hamburger;
let customer2Total = hamburger + milkshake;
console.log(customer1Total);
console.log(customer2Total);Need a nudge?
Read each order separately
The first customer needs all three named prices. The second does not order fries.
Three burgers share one price
Multiply hamburger by 3, then add milkshake. Do not replace the variable names with hard-coded totals.
Reveal a possible solution
const hamburger = 2.85;
const fries = 2.15;
const milkshake = 2.45;
let customer1Total = hamburger + fries + milkshake;
let customer2Total = 3 * hamburger + milkshake;
console.log(customer1Total);
console.log(customer2Total);This adapts your original practical assignment and its submission into one activity. When signed in, submit here instead of copying a JSFiddle link. Try hamburger = 3, fries = 2, and milkshake = 4: the totals should become 9 and 13. Some decimal inputs can show a tiny floating-point representation difference; that is separate from which items belong in an order. Instructors can review how you built each expression; the check compares only the printed output.
Ready to try it?
Practice in your browser and see your results.
Progress details
Have a question?
Ask the Code Zone community.
Ask a question in The Code Zone (opens in a new tab)Continue learning

7 days freeTry The Code Zone
THE CODE ZONE COMMUNITY
Your next step is easier together.
Try the community free for 7 days.
No charge during your trial. Choose your plan on Skool.
- Ask questions and get support in the community
- Watch every course video walkthrough
- Find a study buddy in the 24/7 study room
Make the most of your trial with Premium.
Choose Premium on Skool to try Thursday live help sessions. Bring your questions, work through code, and get unstuck together.
Scheduled Thursdays in Eastern Time. Check the Skool calendar for your local date and time.
Have a website account? Sign in