Stepthrough Start free

JavaScript for small business: a quote calculator, due-date reminders and API data

Lesson cheat sheetOne page · US letterJSFiddle

A free one-page JavaScript cheat sheet: find page elements, write a price rule, add days to dates and fetch API data into a table.

Free, no sign-up and no email needed. It prints on one letter-size page; the whole sheet is below.

▶StepthroughFree printable cheat sheet · learn.ynteractive.com

JavaScript for small business: a quote calculator, due-date reminders and API data

The three modules of the free JavaScript for Small Business Jump Start, practised there on real JSFiddle screens.

Page parts and a click

Find
document.querySelector('#sqft') finds the element with id="sqft".
Read
Number(box.value) turns what was typed into a number.
Write
result.textContent = 'Estimate: $' + price.toFixed(2);
Click
button.onclick = () => { ... }; runs on every click.

A price rule with a minimum

  1. const RATE = 0.12; and const MINIMUM = 150; at the top.
  2. function quote(sqft) { return Math.max(sqft * RATE, MINIMUM); }
  3. Math.max picks the bigger number: small jobs pay the minimum.

Due dates

  1. const d = new Date(issued + 'T00:00');
  2. d.setDate(d.getDate() + 30); adds 30 days (Net 30).
  3. Math.round((due - today) / 86400000) days left; below 0 is overdue.
  4. At work use const today = new Date();

Data from an API

  1. const response = await fetch(url);
  2. const users = await response.json(); inside an async function.
  3. for (const u of users) { ... u.company.name ... } one row each.

Good habits

  • Give every element you use an id.
  • Keep business numbers in const lines at the top.
  • Click the tidy icon in JSFiddle to indent your code.
  • Never put a real API key in a public page or fiddle.

Remember: Put the business rule in one place and let the page do the arithmetic: one edit changes every quote, date and table.

Practice it free: JavaScript: An Instant Quote Calculator for Your Website at learn.ynteractive.com/modules/js-quote-calculator. This sheet: learn.ynteractive.com/content/cheat-sheets/javascript-small-business. Brightway Office Cleaning and Northgate Bookkeeping is a made-up business from the lesson. By Robert Breen, October 24, 2026.

Practice it in the free lesson

JavaScript: An Instant Quote Calculator for Your Website. A beginner JavaScript walkthrough in the free JSFiddle: a four-line HTML form and a few lines of JavaScript that turn square feet into a price, with a minimum charge, typed and run by you. You do every step yourself in a practice copy of JSFiddle, it checks your work as you go, and “Do it for me” finishes any step you get stuck on. Free, and nothing touches your real accounts.

Start the free lesson

Or read the full step-by-step guide

Lessons on this sheet

Plain-English definitions, each with an example from a free lesson.

The full AI glossary

More cheat sheets

All free cheat sheets · All free tutorials