JAVASCRIPT / NUMBERS · STEP 1 OF 4
Calculate with numbers and numeric text
Checking your account…
GUIDED PRACTICE
Calculate with numbers and numeric text
Follow the current step, write the requested code and choose Run & check this step. Your own program carries forward.
Your code stays in one editor through every step. Word wrap is enabled.
Step 1 of 4
Store a numeric price
Numbers do not need quotes. Keep money calculations simple here so you can focus on arithmetic and conversion.
Your task
In script.js, make the changes in the checklist. Keep the working code from earlier steps.
To pass this step:
- Declare
const price = 8;.
Press the play button labeled Run & check this step below the editor to run your code and see your check results.
Your editor is opening.
Each step builds on the last. Finish the current step before opening the next one; your code stays with you.
This is one possible solution. Compare it with your own code; opening it does not replace your work or complete a step.
// Build your program one step at a time.
const price = 8;// Build your program one step at a time.
const price = 8;
const quantity = 3;
const subtotal = price * quantity;// Build your program one step at a time.
const price = 8;
const quantity = 3;
const subtotal = price * quantity;
const deliveryText = "2";
const total = subtotal + Number(deliveryText);// Build your program one step at a time.
const price = 8;
const quantity = 3;
const subtotal = price * quantity;
const deliveryText = "2";
const total = subtotal + Number(deliveryText);
console.log(total);
console.log(typeof total);Code and completed steps save in this browser when signed out. Sign in to save across devices.
Choose the copy to continue. Your account work will only be replaced if you choose this device.
Ready to checkRun the checks to see your results here.