Use these notes to review a concept or read at your own pace. The interactive workspace above adds predictions, editable code, and actual run results.
IDEA 1
A number needs a unit and a measurement context
A mass value without a unit is incomplete. One kilogram equals 1,000 grams, so 0.5 kilograms and 500 grams represent the same mass. Convert every valid row to a common unit before adding values.
A measurement also needs context: its record ID, time, and scale status. The classroom tool rejects negative or nonnumeric mass, missing or unsupported units, a failed scale status, and readings outside the declared period. It does not repair unknown values by guessing.
Normalize before adding
- Observe. A row records half a kilogram during the audit period.
- Validate. Check unit, value, time, and the fixture scale-status field.
- Convert. Express the accepted reading in grams.
- Sum. Only normalized valid rows enter the total.
Synthetic cafeteria readings, not measurements or findings about a real school.
Never add unlike units directly
// Wrong: 0.5 kg + 250 g is not 250.5 g.
const totalGrams = 0.5 * 1000 + 250; // 750The conversion changes representation, not the underlying mass. The final field totalGrams states the output unit explicitly.
Think it through: A row says mass: 500 but has no unit. What is justified?
IDEA 2
Duplicates and exclusions belong in the report
A repeated record ID may be the same measurement delivered twice. This exercise keeps the first occurrence of each ID and marks later occurrences duplicate-id before validation. That rule is explicit: it does not guess that the later row is a correction.
The result contains totalGrams, includedCount, excluded IDs and reasons, and the exact audit period. A zero total can mean no valid readings, so the count matters. This small sample cannot establish school-wide waste trends or environmental impact.
Make the denominator of your total visible
- Remember IDs. Track IDs only within this run to avoid double counting.
- Exclude. A second bin-a row receives a specific reason.
- Report. Keep the count and period next to the mass total.
Minutes 720–750 mean 12:00–12:30 in the fictional day; the end is excluded.
Detect a repeated ID before adding mass
if (seen.has(row.id)) {
excluded.push({ id: row.id, reason: "duplicate-id" });
continue;
}
seen.add(row.id);continue skips the remaining processing of this duplicate. The first occurrence is remembered even if it later fails validation, so the rule consistently favors the first observed record.
Think it through: The result is 0 grams with includedCount: 0. What can you conclude?
Put it into practice
Sum each valid ID once in grams and return exclusions with the exact period.
- Read the units and scaleStatus fields before predicting the total.
- Run the starter and inspect the duplicate ID being counted twice.
- Insert the seen-ID guard at the start of the row loop.
- Run mixed-unit, invalid-reading, and period-boundary cases.
- Change an invalid row to valid and predict both the mass and included count.
Your next experiment: Change unit to kg, then compare the total. Why must a unit correction be a deliberate data change?
A defensible total preserves units, unique records, exclusions, and the limits of the observation period.
Key terms
- Normalization
- Converting values to a common representation so they can be compared or combined correctly.
- Duplicate
- A repeated record identity; this exercise retains its first occurrence.
Sources and scope
Original Stemtiq teaching, reviewed 2026-09-14. The named researchers and organizations do not endorse this course. Classroom cases are authored exercises, not published findings.
MDN Web Docs: JavaScript Guide
Updated 7 November 2025
Functions, objects, conditions, loops, and asynchronous code provide the programming foundations for an agent controller.
Ordinary JavaScript rules do not imply that a language model is running. An execution environment may support only part of the language or its host APIs.
Anthropic: Writing effective tools for agents — with agents
11 September 2025
Design distinct tools with clear parameters, relevant returned information, and evaluations of how the agent actually uses them.
A description or schema does not guarantee the right action. A live tool can return different data for the same arguments as its environment changes.
Anthropic: Demystifying evals for AI agents
9 January 2026
Define tasks, trials, and graders; inspect both execution records and final outcomes; repeat trials when model behavior varies.
A score depends on its cases and grading rules. Repeating a deterministic classroom case does not measure the variability of a live model.