Small Group Tutorials

Here to help students catch up, keep up, and move ahead. Book a consultation here.

How to Master JavaScript Intl.DurationFormat in Punggol Tuition

Student in a navy skirt and tie holds a notebook and makes a peace sign in a bright corridor.

When a learner can reproduce a familiar example but a small variation causes confusion, the problem is usually an incomplete model rather than a lack of effort. The fastest useful response is to expose the hidden state and test one boundary at a time.

JavaScript Intl.DurationFormat turns a structured duration record into locale-aware text or parts. It does not measure elapsed time, subtract dates or decide how months convert to days. Mastery means separating duration arithmetic from presentation, predicting which fields display under each option, and testing both the chosen locale contract and the runtime that will execute it. This guide begins with that mechanism, then develops it through worked traces, deliberate mistakes, explained practice and transfer decisions.

The aim is independent reasoning. A learner should be able to predict behaviour, locate the earliest wrong assumption, use a safe diagnostic procedure and defend a design choice in a new project.

Punggol families can use the guide in short sessions around homework, CCAs and rest. The activities are proposed learning exercises, not claims about a physical branch, timetable, class size, fee, school relationship or guaranteed result.

Use disposable data and repositories, preserve backups, and check version-sensitive details against the official source. Current documentation settles a technical contract; observation and explanation turn that contract into usable knowledge.

Find your next learning step

Choose the route that matches the present difficulty. Use the complete index for a systematic course.

Build the model

Chapters 1-4 . Begin here, then continue after the learner can predict, verify and explain.

Use the core tools

Chapters 5-8 . Begin here, then continue after the learner can predict, verify and explain.

Handle boundaries

Chapters 9-12 . Begin here, then continue after the learner can predict, verify and explain.

Debug and verify

Chapters 13-16 . Begin here, then continue after the learner can predict, verify and explain.

Transfer with judgment

Chapters 17-20 . Begin here, then continue after the learner can predict, verify and explain.

Open the full chapter index . Jump to capstone practice . Use the How Studying Works hub . Read the official documentation

CHAPTER 1 OF 20 . Build the model

1. Duration formatting is presentation

Back to contents

Intl.DurationFormat receives duration fields and formats them; it does not compute the fields from timestamps. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is passing two dates and expecting subtraction or calendar arithmetic. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Calculate or obtain a duration record first, then give that record to the formatter.

For the Duration formatting is presentation chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on passing two dates and expecting subtraction or calendar arithmetic. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const df=new Intl.DurationFormat('en',{style:'long'});
df.format({hours:1,minutes:30});

Explained result. The formatter presents one hour and thirty minutes according to the resolved English conventions. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework timer. Predict the rule using hours, minutes and seconds spent on focused work. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Intl.DurationFormat receives duration fields and formats them; it does not compute the fields from timestamps.” Apply this procedure: Calculate or obtain a duration record first, then give that record to the formatter. The expected mechanism is: The formatter presents one hour and thirty minutes according to the resolved English conventions. For the homework timer, add one near-miss that exposes passing two dates and expecting subtraction or calendar arithmetic. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library visit. Contrast the rule using minutes for travel, browsing and borrowing. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Intl.DurationFormat receives duration fields and formats them; it does not compute the fields from timestamps.” Apply this procedure: Calculate or obtain a duration record first, then give that record to the formatter. The expected mechanism is: The formatter presents one hour and thirty minutes according to the resolved English conventions. For the library visit, add one near-miss that exposes passing two dates and expecting subtraction or calendar arithmetic. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: CCA rehearsal. Stress-test the rule using hours and minutes in a practice block. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Intl.DurationFormat receives duration fields and formats them; it does not compute the fields from timestamps.” Apply this procedure: Calculate or obtain a duration record first, then give that record to the formatter. The expected mechanism is: The formatter presents one hour and thirty minutes according to the resolved English conventions. For the CCA rehearsal, add one near-miss that exposes passing two dates and expecting subtraction or calendar arithmetic. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: science observation. Explain the rule using seconds, milliseconds and instrument resolution. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Intl.DurationFormat receives duration fields and formats them; it does not compute the fields from timestamps.” Apply this procedure: Calculate or obtain a duration record first, then give that record to the formatter. The expected mechanism is: The formatter presents one hour and thirty minutes according to the resolved English conventions. For the science observation, add one near-miss that exposes passing two dates and expecting subtraction or calendar arithmetic. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers passing two dates and expecting subtraction or calendar arithmetic.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Calculate or obtain a duration record first, then give that record to the formatter.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Duration formatting is presentation?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing passing two dates and expecting subtraction or calendar arithmetic be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family journey with hours and minutes across route segments. Include one ordinary case, one boundary and one deliberate failure caused by passing two dates and expecting subtraction or calendar arithmetic. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Intl.DurationFormat receives duration fields and formats them; it does not compute the fields from timestamps. It shows a trace, not only a final value. The ordinary case should demonstrate “The formatter presents one hour and thirty minutes according to the resolved English conventions.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Calculate or obtain a duration record first, then give that record to the formatter. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Duration formatting is presentation, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 2 OF 20 . Build the model

2. Construct with new

Back to contents

The specification requires Intl.DurationFormat to be constructed; calling it without new throws TypeError. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is copying call patterns from Intl.NumberFormat without checking this constructor contract. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use new and make the construction step visible in examples and factories.

For the Construct with new chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on copying call patterns from Intl.NumberFormat without checking this constructor contract. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const df=new Intl.DurationFormat('en-SG');

Explained result. df is an initialized duration formatter for a resolved locale. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: CCA rehearsal. Contrast the rule using hours and minutes in a practice block. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The specification requires Intl.DurationFormat to be constructed; calling it without new throws TypeError.” Apply this procedure: Use new and make the construction step visible in examples and factories. The expected mechanism is: df is an initialized duration formatter for a resolved locale. For the CCA rehearsal, add one near-miss that exposes copying call patterns from Intl.NumberFormat without checking this constructor contract. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: science observation. Stress-test the rule using seconds, milliseconds and instrument resolution. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The specification requires Intl.DurationFormat to be constructed; calling it without new throws TypeError.” Apply this procedure: Use new and make the construction step visible in examples and factories. The expected mechanism is: df is an initialized duration formatter for a resolved locale. For the science observation, add one near-miss that exposes copying call patterns from Intl.NumberFormat without checking this constructor contract. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: revision plan. Explain the rule using days, hours and short study intervals. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The specification requires Intl.DurationFormat to be constructed; calling it without new throws TypeError.” Apply this procedure: Use new and make the construction step visible in examples and factories. The expected mechanism is: df is an initialized duration formatter for a resolved locale. For the revision plan, add one near-miss that exposes copying call patterns from Intl.NumberFormat without checking this constructor contract. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: family journey. Transfer the rule using hours and minutes across route segments. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The specification requires Intl.DurationFormat to be constructed; calling it without new throws TypeError.” Apply this procedure: Use new and make the construction step visible in examples and factories. The expected mechanism is: df is an initialized duration formatter for a resolved locale. For the family journey, add one near-miss that exposes copying call patterns from Intl.NumberFormat without checking this constructor contract. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers copying call patterns from Intl.NumberFormat without checking this constructor contract.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Use new and make the construction step visible in examples and factories.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Construct with new?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing copying call patterns from Intl.NumberFormat without checking this constructor contract be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny coding benchmark with milliseconds, microseconds and display precision. Include one ordinary case, one boundary and one deliberate failure caused by copying call patterns from Intl.NumberFormat without checking this constructor contract. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The specification requires Intl.DurationFormat to be constructed; calling it without new throws TypeError. It shows a trace, not only a final value. The ordinary case should demonstrate “df is an initialized duration formatter for a resolved locale.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use new and make the construction step visible in examples and factories. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Construct with new, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 3 OF 20 . Build the model

3. Duration input is a record

Back to contents

The input object can contain years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds and nanoseconds. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is passing a number of seconds directly and expecting the API to infer its unit. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use an object whose property name states each unit explicitly.

For the Duration input is a record chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on passing a number of seconds directly and expecting the API to infer its unit. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

df.format({minutes:12,seconds:5});

Explained result. The record represents twelve minutes and five seconds without an unstated unit guess. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: revision plan. Stress-test the rule using days, hours and short study intervals. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The input object can contain years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds and nanoseconds.” Apply this procedure: Use an object whose property name states each unit explicitly. The expected mechanism is: The record represents twelve minutes and five seconds without an unstated unit guess. For the revision plan, add one near-miss that exposes passing a number of seconds directly and expecting the API to infer its unit. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: family journey. Explain the rule using hours and minutes across route segments. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The input object can contain years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds and nanoseconds.” Apply this procedure: Use an object whose property name states each unit explicitly. The expected mechanism is: The record represents twelve minutes and five seconds without an unstated unit guess. For the family journey, add one near-miss that exposes passing a number of seconds directly and expecting the API to infer its unit. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: coding benchmark. Transfer the rule using milliseconds, microseconds and display precision. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The input object can contain years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds and nanoseconds.” Apply this procedure: Use an object whose property name states each unit explicitly. The expected mechanism is: The record represents twelve minutes and five seconds without an unstated unit guess. For the coding benchmark, add one near-miss that exposes passing a number of seconds directly and expecting the API to infer its unit. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: project countdown. Predict the rule using weeks, days and hours remaining. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The input object can contain years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds and nanoseconds.” Apply this procedure: Use an object whose property name states each unit explicitly. The expected mechanism is: The record represents twelve minutes and five seconds without an unstated unit guess. For the project countdown, add one near-miss that exposes passing a number of seconds directly and expecting the API to infer its unit. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers passing a number of seconds directly and expecting the API to infer its unit.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Use an object whose property name states each unit explicitly.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Duration input is a record?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing passing a number of seconds directly and expecting the API to infer its unit be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny project countdown with weeks, days and hours remaining. Include one ordinary case, one boundary and one deliberate failure caused by passing a number of seconds directly and expecting the API to infer its unit. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The input object can contain years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds and nanoseconds. It shows a trace, not only a final value. The ordinary case should demonstrate “The record represents twelve minutes and five seconds without an unstated unit guess.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use an object whose property name states each unit explicitly. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Duration input is a record, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 4 OF 20 . Build the model

4. At least one field is required

Back to contents

An object with none of the recognised duration properties is rejected instead of formatting as an empty duration. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is passing an unrelated object and interpreting the error as a locale problem. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Validate the record shape before formatting and include an explicit zero field when zero is meaningful.

For the At least one field is required chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on passing an unrelated object and interpreting the error as a locale problem. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

df.format({seconds:0});

Explained result. The record has a recognised field and can produce the formatter’s zero-second representation. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: coding benchmark. Explain the rule using milliseconds, microseconds and display precision. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An object with none of the recognised duration properties is rejected instead of formatting as an empty duration.” Apply this procedure: Validate the record shape before formatting and include an explicit zero field when zero is meaningful. The expected mechanism is: The record has a recognised field and can produce the formatter’s zero-second representation. For the coding benchmark, add one near-miss that exposes passing an unrelated object and interpreting the error as a locale problem. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: project countdown. Transfer the rule using weeks, days and hours remaining. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An object with none of the recognised duration properties is rejected instead of formatting as an empty duration.” Apply this procedure: Validate the record shape before formatting and include an explicit zero field when zero is meaningful. The expected mechanism is: The record has a recognised field and can produce the formatter’s zero-second representation. For the project countdown, add one near-miss that exposes passing an unrelated object and interpreting the error as a locale problem. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework timer. Predict the rule using hours, minutes and seconds spent on focused work. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An object with none of the recognised duration properties is rejected instead of formatting as an empty duration.” Apply this procedure: Validate the record shape before formatting and include an explicit zero field when zero is meaningful. The expected mechanism is: The record has a recognised field and can produce the formatter’s zero-second representation. For the homework timer, add one near-miss that exposes passing an unrelated object and interpreting the error as a locale problem. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library visit. Contrast the rule using minutes for travel, browsing and borrowing. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An object with none of the recognised duration properties is rejected instead of formatting as an empty duration.” Apply this procedure: Validate the record shape before formatting and include an explicit zero field when zero is meaningful. The expected mechanism is: The record has a recognised field and can produce the formatter’s zero-second representation. For the library visit, add one near-miss that exposes passing an unrelated object and interpreting the error as a locale problem. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers passing an unrelated object and interpreting the error as a locale problem.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Validate the record shape before formatting and include an explicit zero field when zero is meaningful.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from At least one field is required?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing passing an unrelated object and interpreting the error as a locale problem be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny homework timer with hours, minutes and seconds spent on focused work. Include one ordinary case, one boundary and one deliberate failure caused by passing an unrelated object and interpreting the error as a locale problem. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: An object with none of the recognised duration properties is rejected instead of formatting as an empty duration. It shows a trace, not only a final value. The ordinary case should demonstrate “The record has a recognised field and can produce the formatter’s zero-second representation.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Validate the record shape before formatting and include an explicit zero field when zero is meaningful. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For At least one field is required, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 5 OF 20 . Use the core tools

5. Field values must be integral

Back to contents

Each supplied duration field is converted to a Number and must be an integral value; non-integral values cause RangeError. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is putting 1.5 in seconds instead of expressing fractional precision with smaller units. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Convert the amount into integer seconds and subsecond units before formatting.

For the Field values must be integral chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on putting 1.5 in seconds instead of expressing fractional precision with smaller units. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

df.format({seconds:1,milliseconds:500});

Explained result. The structured record expresses one and a half seconds without a fractional seconds field. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework timer. Transfer the rule using hours, minutes and seconds spent on focused work. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Each supplied duration field is converted to a Number and must be an integral value; non-integral values cause RangeError.” Apply this procedure: Convert the amount into integer seconds and subsecond units before formatting. The expected mechanism is: The structured record expresses one and a half seconds without a fractional seconds field. For the homework timer, add one near-miss that exposes putting 1.5 in seconds instead of expressing fractional precision with smaller units. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library visit. Predict the rule using minutes for travel, browsing and borrowing. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Each supplied duration field is converted to a Number and must be an integral value; non-integral values cause RangeError.” Apply this procedure: Convert the amount into integer seconds and subsecond units before formatting. The expected mechanism is: The structured record expresses one and a half seconds without a fractional seconds field. For the library visit, add one near-miss that exposes putting 1.5 in seconds instead of expressing fractional precision with smaller units. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: CCA rehearsal. Contrast the rule using hours and minutes in a practice block. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Each supplied duration field is converted to a Number and must be an integral value; non-integral values cause RangeError.” Apply this procedure: Convert the amount into integer seconds and subsecond units before formatting. The expected mechanism is: The structured record expresses one and a half seconds without a fractional seconds field. For the CCA rehearsal, add one near-miss that exposes putting 1.5 in seconds instead of expressing fractional precision with smaller units. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: science observation. Stress-test the rule using seconds, milliseconds and instrument resolution. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Each supplied duration field is converted to a Number and must be an integral value; non-integral values cause RangeError.” Apply this procedure: Convert the amount into integer seconds and subsecond units before formatting. The expected mechanism is: The structured record expresses one and a half seconds without a fractional seconds field. For the science observation, add one near-miss that exposes putting 1.5 in seconds instead of expressing fractional precision with smaller units. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers putting 1.5 in seconds instead of expressing fractional precision with smaller units.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Convert the amount into integer seconds and subsecond units before formatting.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Field values must be integral?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing putting 1.5 in seconds instead of expressing fractional precision with smaller units be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library visit with minutes for travel, browsing and borrowing. Include one ordinary case, one boundary and one deliberate failure caused by putting 1.5 in seconds instead of expressing fractional precision with smaller units. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Each supplied duration field is converted to a Number and must be an integral value; non-integral values cause RangeError. It shows a trace, not only a final value. The ordinary case should demonstrate “The structured record expresses one and a half seconds without a fractional seconds field.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Convert the amount into integer seconds and subsecond units before formatting. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Field values must be integral, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 6 OF 20 . Use the core tools

6. All nonzero fields share one sign

Back to contents

A valid duration cannot mix positive and negative nonzero components because that would not be one consistently directed duration. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using hours:1 and minutes:-30 to mean subtraction inside the formatter. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Normalise arithmetic before presentation so the resulting record has one sign.

For the All nonzero fields share one sign chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on using hours:1 and minutes:-30 to mean subtraction inside the formatter. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

df.format({hours:-1,minutes:-30});

Explained result. Both nonzero fields point in the same negative direction and form a valid record. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: CCA rehearsal. Predict the rule using hours and minutes in a practice block. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A valid duration cannot mix positive and negative nonzero components because that would not be one consistently directed duration.” Apply this procedure: Normalise arithmetic before presentation so the resulting record has one sign. The expected mechanism is: Both nonzero fields point in the same negative direction and form a valid record. For the CCA rehearsal, add one near-miss that exposes using hours:1 and minutes:-30 to mean subtraction inside the formatter. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: science observation. Contrast the rule using seconds, milliseconds and instrument resolution. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A valid duration cannot mix positive and negative nonzero components because that would not be one consistently directed duration.” Apply this procedure: Normalise arithmetic before presentation so the resulting record has one sign. The expected mechanism is: Both nonzero fields point in the same negative direction and form a valid record. For the science observation, add one near-miss that exposes using hours:1 and minutes:-30 to mean subtraction inside the formatter. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: revision plan. Stress-test the rule using days, hours and short study intervals. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A valid duration cannot mix positive and negative nonzero components because that would not be one consistently directed duration.” Apply this procedure: Normalise arithmetic before presentation so the resulting record has one sign. The expected mechanism is: Both nonzero fields point in the same negative direction and form a valid record. For the revision plan, add one near-miss that exposes using hours:1 and minutes:-30 to mean subtraction inside the formatter. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: family journey. Explain the rule using hours and minutes across route segments. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A valid duration cannot mix positive and negative nonzero components because that would not be one consistently directed duration.” Apply this procedure: Normalise arithmetic before presentation so the resulting record has one sign. The expected mechanism is: Both nonzero fields point in the same negative direction and form a valid record. For the family journey, add one near-miss that exposes using hours:1 and minutes:-30 to mean subtraction inside the formatter. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using hours:1 and minutes:-30 to mean subtraction inside the formatter.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Normalise arithmetic before presentation so the resulting record has one sign.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from All nonzero fields share one sign?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using hours:1 and minutes:-30 to mean subtraction inside the formatter be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA rehearsal with hours and minutes in a practice block. Include one ordinary case, one boundary and one deliberate failure caused by using hours:1 and minutes:-30 to mean subtraction inside the formatter. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: A valid duration cannot mix positive and negative nonzero components because that would not be one consistently directed duration. It shows a trace, not only a final value. The ordinary case should demonstrate “Both nonzero fields point in the same negative direction and form a valid record.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Normalise arithmetic before presentation so the resulting record has one sign. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For All nonzero fields share one sign, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 7 OF 20 . Use the core tools

7. Locale negotiation changes language

Back to contents

The locales argument requests language and regional conventions, while the runtime resolves an available locale. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is hard-coding English punctuation around a supposedly localised result. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Compare supportedLocalesOf and resolvedOptions before making output assertions.

For the Locale negotiation changes language chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on hard-coding English punctuation around a supposedly localised result. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.DurationFormat('fr',{style:'long'}).format({hours:2})

Explained result. The visible unit wording follows the resolved French locale rather than an English template. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: revision plan. Contrast the rule using days, hours and short study intervals. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The locales argument requests language and regional conventions, while the runtime resolves an available locale.” Apply this procedure: Compare supportedLocalesOf and resolvedOptions before making output assertions. The expected mechanism is: The visible unit wording follows the resolved French locale rather than an English template. For the revision plan, add one near-miss that exposes hard-coding English punctuation around a supposedly localised result. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: family journey. Stress-test the rule using hours and minutes across route segments. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The locales argument requests language and regional conventions, while the runtime resolves an available locale.” Apply this procedure: Compare supportedLocalesOf and resolvedOptions before making output assertions. The expected mechanism is: The visible unit wording follows the resolved French locale rather than an English template. For the family journey, add one near-miss that exposes hard-coding English punctuation around a supposedly localised result. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: coding benchmark. Explain the rule using milliseconds, microseconds and display precision. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The locales argument requests language and regional conventions, while the runtime resolves an available locale.” Apply this procedure: Compare supportedLocalesOf and resolvedOptions before making output assertions. The expected mechanism is: The visible unit wording follows the resolved French locale rather than an English template. For the coding benchmark, add one near-miss that exposes hard-coding English punctuation around a supposedly localised result. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: project countdown. Transfer the rule using weeks, days and hours remaining. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The locales argument requests language and regional conventions, while the runtime resolves an available locale.” Apply this procedure: Compare supportedLocalesOf and resolvedOptions before making output assertions. The expected mechanism is: The visible unit wording follows the resolved French locale rather than an English template. For the project countdown, add one near-miss that exposes hard-coding English punctuation around a supposedly localised result. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers hard-coding English punctuation around a supposedly localised result.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Compare supportedLocalesOf and resolvedOptions before making output assertions.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Locale negotiation changes language?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing hard-coding English punctuation around a supposedly localised result be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science observation with seconds, milliseconds and instrument resolution. Include one ordinary case, one boundary and one deliberate failure caused by hard-coding English punctuation around a supposedly localised result. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The locales argument requests language and regional conventions, while the runtime resolves an available locale. It shows a trace, not only a final value. The ordinary case should demonstrate “The visible unit wording follows the resolved French locale rather than an English template.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Compare supportedLocalesOf and resolvedOptions before making output assertions. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Locale negotiation changes language, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 8 OF 20 . Use the core tools

8. The default style is short

Back to contents

When style is omitted, the constructor uses short duration formatting as the overall style. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is assuming long words because an example happened to specify style long. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Inspect resolvedOptions and set style explicitly when product copy depends on it.

For the The default style is short chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on assuming long words because an example happened to specify style long. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.DurationFormat('en').resolvedOptions().style

Explained result. The resolved overall style is short. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: coding benchmark. Stress-test the rule using milliseconds, microseconds and display precision. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When style is omitted, the constructor uses short duration formatting as the overall style.” Apply this procedure: Inspect resolvedOptions and set style explicitly when product copy depends on it. The expected mechanism is: The resolved overall style is short. For the coding benchmark, add one near-miss that exposes assuming long words because an example happened to specify style long. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: project countdown. Explain the rule using weeks, days and hours remaining. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When style is omitted, the constructor uses short duration formatting as the overall style.” Apply this procedure: Inspect resolvedOptions and set style explicitly when product copy depends on it. The expected mechanism is: The resolved overall style is short. For the project countdown, add one near-miss that exposes assuming long words because an example happened to specify style long. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework timer. Transfer the rule using hours, minutes and seconds spent on focused work. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When style is omitted, the constructor uses short duration formatting as the overall style.” Apply this procedure: Inspect resolvedOptions and set style explicitly when product copy depends on it. The expected mechanism is: The resolved overall style is short. For the homework timer, add one near-miss that exposes assuming long words because an example happened to specify style long. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library visit. Predict the rule using minutes for travel, browsing and borrowing. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “When style is omitted, the constructor uses short duration formatting as the overall style.” Apply this procedure: Inspect resolvedOptions and set style explicitly when product copy depends on it. The expected mechanism is: The resolved overall style is short. For the library visit, add one near-miss that exposes assuming long words because an example happened to specify style long. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers assuming long words because an example happened to specify style long.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Inspect resolvedOptions and set style explicitly when product copy depends on it.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from The default style is short?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming long words because an example happened to specify style long be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision plan with days, hours and short study intervals. Include one ordinary case, one boundary and one deliberate failure caused by assuming long words because an example happened to specify style long. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: When style is omitted, the constructor uses short duration formatting as the overall style. It shows a trace, not only a final value. The ordinary case should demonstrate “The resolved overall style is short.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Inspect resolvedOptions and set style explicitly when product copy depends on it. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For The default style is short, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 9 OF 20 . Handle boundaries

9. Long, short and narrow are semantic choices

Back to contents

The three textual styles request different degrees of unit-name abbreviation while remaining locale-sensitive. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is treating narrow as a guaranteed fixed ASCII token format. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Test representative locales and never parse the formatted string as data.

For the Long, short and narrow are semantic choices chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on treating narrow as a guaranteed fixed ASCII token format. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

for(const style of ['long','short','narrow']) console.log(new Intl.DurationFormat('en',{style}).format({hours:2,minutes:5}));

Explained result. The three results can vary in words, abbreviations and spacing while representing the same record. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework timer. Explain the rule using hours, minutes and seconds spent on focused work. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The three textual styles request different degrees of unit-name abbreviation while remaining locale-sensitive.” Apply this procedure: Test representative locales and never parse the formatted string as data. The expected mechanism is: The three results can vary in words, abbreviations and spacing while representing the same record. For the homework timer, add one near-miss that exposes treating narrow as a guaranteed fixed ASCII token format. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library visit. Transfer the rule using minutes for travel, browsing and borrowing. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The three textual styles request different degrees of unit-name abbreviation while remaining locale-sensitive.” Apply this procedure: Test representative locales and never parse the formatted string as data. The expected mechanism is: The three results can vary in words, abbreviations and spacing while representing the same record. For the library visit, add one near-miss that exposes treating narrow as a guaranteed fixed ASCII token format. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: CCA rehearsal. Predict the rule using hours and minutes in a practice block. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The three textual styles request different degrees of unit-name abbreviation while remaining locale-sensitive.” Apply this procedure: Test representative locales and never parse the formatted string as data. The expected mechanism is: The three results can vary in words, abbreviations and spacing while representing the same record. For the CCA rehearsal, add one near-miss that exposes treating narrow as a guaranteed fixed ASCII token format. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: science observation. Contrast the rule using seconds, milliseconds and instrument resolution. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The three textual styles request different degrees of unit-name abbreviation while remaining locale-sensitive.” Apply this procedure: Test representative locales and never parse the formatted string as data. The expected mechanism is: The three results can vary in words, abbreviations and spacing while representing the same record. For the science observation, add one near-miss that exposes treating narrow as a guaranteed fixed ASCII token format. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers treating narrow as a guaranteed fixed ASCII token format.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Test representative locales and never parse the formatted string as data.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Long, short and narrow are semantic choices?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating narrow as a guaranteed fixed ASCII token format be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family journey with hours and minutes across route segments. Include one ordinary case, one boundary and one deliberate failure caused by treating narrow as a guaranteed fixed ASCII token format. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The three textual styles request different degrees of unit-name abbreviation while remaining locale-sensitive. It shows a trace, not only a final value. The ordinary case should demonstrate “The three results can vary in words, abbreviations and spacing while representing the same record.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Test representative locales and never parse the formatted string as data. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Long, short and narrow are semantic choices, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 10 OF 20 . Handle boundaries

10. Digital is a coordinated style

Back to contents

Digital style uses locale data for hour-minute and minute-second separators and coordinated numeric field defaults. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is building a colon string manually and calling it locale-aware. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Let the formatter choose separators and two-digit behavior, then test exact target locales.

For the Digital is a coordinated style chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on building a colon string manually and calling it locale-aware. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.DurationFormat('en',{style:'digital'}).format({hours:1,minutes:2,seconds:3})

Explained result. The output is a locale-aware digital duration rather than a manually joined trio. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: CCA rehearsal. Transfer the rule using hours and minutes in a practice block. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Digital style uses locale data for hour-minute and minute-second separators and coordinated numeric field defaults.” Apply this procedure: Let the formatter choose separators and two-digit behavior, then test exact target locales. The expected mechanism is: The output is a locale-aware digital duration rather than a manually joined trio. For the CCA rehearsal, add one near-miss that exposes building a colon string manually and calling it locale-aware. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: science observation. Predict the rule using seconds, milliseconds and instrument resolution. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Digital style uses locale data for hour-minute and minute-second separators and coordinated numeric field defaults.” Apply this procedure: Let the formatter choose separators and two-digit behavior, then test exact target locales. The expected mechanism is: The output is a locale-aware digital duration rather than a manually joined trio. For the science observation, add one near-miss that exposes building a colon string manually and calling it locale-aware. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: revision plan. Contrast the rule using days, hours and short study intervals. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Digital style uses locale data for hour-minute and minute-second separators and coordinated numeric field defaults.” Apply this procedure: Let the formatter choose separators and two-digit behavior, then test exact target locales. The expected mechanism is: The output is a locale-aware digital duration rather than a manually joined trio. For the revision plan, add one near-miss that exposes building a colon string manually and calling it locale-aware. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: family journey. Stress-test the rule using hours and minutes across route segments. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Digital style uses locale data for hour-minute and minute-second separators and coordinated numeric field defaults.” Apply this procedure: Let the formatter choose separators and two-digit behavior, then test exact target locales. The expected mechanism is: The output is a locale-aware digital duration rather than a manually joined trio. For the family journey, add one near-miss that exposes building a colon string manually and calling it locale-aware. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers building a colon string manually and calling it locale-aware.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Let the formatter choose separators and two-digit behavior, then test exact target locales.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Digital is a coordinated style?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing building a colon string manually and calling it locale-aware be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny coding benchmark with milliseconds, microseconds and display precision. Include one ordinary case, one boundary and one deliberate failure caused by building a colon string manually and calling it locale-aware. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Digital style uses locale data for hour-minute and minute-second separators and coordinated numeric field defaults. It shows a trace, not only a final value. The ordinary case should demonstrate “The output is a locale-aware digital duration rather than a manually joined trio.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Let the formatter choose separators and two-digit behavior, then test exact target locales. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Digital is a coordinated style, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 11 OF 20 . Handle boundaries

11. Unit display controls zero fields

Back to contents

Per-unit display options decide whether a unit appears always or automatically under the applicable rules. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is assuming every property supplied with zero must be printed. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Set the unit display policy explicitly and verify zero-only and mixed records.

For the Unit display controls zero fields chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on assuming every property supplied with zero must be printed. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.DurationFormat('en',{seconds:'long',secondsDisplay:'always'}).format({seconds:0})

Explained result. The explicit display policy keeps the seconds field visible. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: revision plan. Predict the rule using days, hours and short study intervals. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Per-unit display options decide whether a unit appears always or automatically under the applicable rules.” Apply this procedure: Set the unit display policy explicitly and verify zero-only and mixed records. The expected mechanism is: The explicit display policy keeps the seconds field visible. For the revision plan, add one near-miss that exposes assuming every property supplied with zero must be printed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: family journey. Contrast the rule using hours and minutes across route segments. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Per-unit display options decide whether a unit appears always or automatically under the applicable rules.” Apply this procedure: Set the unit display policy explicitly and verify zero-only and mixed records. The expected mechanism is: The explicit display policy keeps the seconds field visible. For the family journey, add one near-miss that exposes assuming every property supplied with zero must be printed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: coding benchmark. Stress-test the rule using milliseconds, microseconds and display precision. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Per-unit display options decide whether a unit appears always or automatically under the applicable rules.” Apply this procedure: Set the unit display policy explicitly and verify zero-only and mixed records. The expected mechanism is: The explicit display policy keeps the seconds field visible. For the coding benchmark, add one near-miss that exposes assuming every property supplied with zero must be printed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: project countdown. Explain the rule using weeks, days and hours remaining. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Per-unit display options decide whether a unit appears always or automatically under the applicable rules.” Apply this procedure: Set the unit display policy explicitly and verify zero-only and mixed records. The expected mechanism is: The explicit display policy keeps the seconds field visible. For the project countdown, add one near-miss that exposes assuming every property supplied with zero must be printed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers assuming every property supplied with zero must be printed.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Set the unit display policy explicitly and verify zero-only and mixed records.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Unit display controls zero fields?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming every property supplied with zero must be printed be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny project countdown with weeks, days and hours remaining. Include one ordinary case, one boundary and one deliberate failure caused by assuming every property supplied with zero must be printed. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Per-unit display options decide whether a unit appears always or automatically under the applicable rules. It shows a trace, not only a final value. The ordinary case should demonstrate “The explicit display policy keeps the seconds field visible.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Set the unit display policy explicitly and verify zero-only and mixed records. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Unit display controls zero fields, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 12 OF 20 . Handle boundaries

12. Per-unit styles can refine the result

Back to contents

Unit options such as hours, minutes or seconds can select allowed textual or numeric styles within the constructor rules. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is combining arbitrary unit styles without checking the option dependencies. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Read resolvedOptions and reduce the case when an option combination throws.

For the Per-unit styles can refine the result chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on combining arbitrary unit styles without checking the option dependencies. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.DurationFormat('en',{hours:'numeric',minutes:'2-digit'}).resolvedOptions()

Explained result. The resolved object reveals which styles and display settings were accepted. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: coding benchmark. Contrast the rule using milliseconds, microseconds and display precision. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Unit options such as hours, minutes or seconds can select allowed textual or numeric styles within the constructor rules.” Apply this procedure: Read resolvedOptions and reduce the case when an option combination throws. The expected mechanism is: The resolved object reveals which styles and display settings were accepted. For the coding benchmark, add one near-miss that exposes combining arbitrary unit styles without checking the option dependencies. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: project countdown. Stress-test the rule using weeks, days and hours remaining. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Unit options such as hours, minutes or seconds can select allowed textual or numeric styles within the constructor rules.” Apply this procedure: Read resolvedOptions and reduce the case when an option combination throws. The expected mechanism is: The resolved object reveals which styles and display settings were accepted. For the project countdown, add one near-miss that exposes combining arbitrary unit styles without checking the option dependencies. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework timer. Explain the rule using hours, minutes and seconds spent on focused work. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Unit options such as hours, minutes or seconds can select allowed textual or numeric styles within the constructor rules.” Apply this procedure: Read resolvedOptions and reduce the case when an option combination throws. The expected mechanism is: The resolved object reveals which styles and display settings were accepted. For the homework timer, add one near-miss that exposes combining arbitrary unit styles without checking the option dependencies. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library visit. Transfer the rule using minutes for travel, browsing and borrowing. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Unit options such as hours, minutes or seconds can select allowed textual or numeric styles within the constructor rules.” Apply this procedure: Read resolvedOptions and reduce the case when an option combination throws. The expected mechanism is: The resolved object reveals which styles and display settings were accepted. For the library visit, add one near-miss that exposes combining arbitrary unit styles without checking the option dependencies. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers combining arbitrary unit styles without checking the option dependencies.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Read resolvedOptions and reduce the case when an option combination throws.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Per-unit styles can refine the result?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing combining arbitrary unit styles without checking the option dependencies be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny homework timer with hours, minutes and seconds spent on focused work. Include one ordinary case, one boundary and one deliberate failure caused by combining arbitrary unit styles without checking the option dependencies. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Unit options such as hours, minutes or seconds can select allowed textual or numeric styles within the constructor rules. It shows a trace, not only a final value. The ordinary case should demonstrate “The resolved object reveals which styles and display settings were accepted.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Read resolvedOptions and reduce the case when an option combination throws. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Per-unit styles can refine the result, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 13 OF 20 . Debug and verify

13. fractionalDigits ranges from zero to nine

Back to contents

The fractionalDigits option accepts an integer from zero through nine and controls numeric subsecond precision. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using a value outside the range or expecting it to accept arbitrary precision. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Test minimum, maximum and one invalid value during configuration validation.

For the fractionalDigits ranges from zero to nine chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on using a value outside the range or expecting it to accept arbitrary precision. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.DurationFormat('en',{style:'digital',fractionalDigits:3}).format({seconds:1,milliseconds:234})

Explained result. The numeric seconds portion can include three fractional digits derived from subsecond fields. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework timer. Stress-test the rule using hours, minutes and seconds spent on focused work. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The fractionalDigits option accepts an integer from zero through nine and controls numeric subsecond precision.” Apply this procedure: Test minimum, maximum and one invalid value during configuration validation. The expected mechanism is: The numeric seconds portion can include three fractional digits derived from subsecond fields. For the homework timer, add one near-miss that exposes using a value outside the range or expecting it to accept arbitrary precision. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library visit. Explain the rule using minutes for travel, browsing and borrowing. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The fractionalDigits option accepts an integer from zero through nine and controls numeric subsecond precision.” Apply this procedure: Test minimum, maximum and one invalid value during configuration validation. The expected mechanism is: The numeric seconds portion can include three fractional digits derived from subsecond fields. For the library visit, add one near-miss that exposes using a value outside the range or expecting it to accept arbitrary precision. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: CCA rehearsal. Transfer the rule using hours and minutes in a practice block. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The fractionalDigits option accepts an integer from zero through nine and controls numeric subsecond precision.” Apply this procedure: Test minimum, maximum and one invalid value during configuration validation. The expected mechanism is: The numeric seconds portion can include three fractional digits derived from subsecond fields. For the CCA rehearsal, add one near-miss that exposes using a value outside the range or expecting it to accept arbitrary precision. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: science observation. Predict the rule using seconds, milliseconds and instrument resolution. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “The fractionalDigits option accepts an integer from zero through nine and controls numeric subsecond precision.” Apply this procedure: Test minimum, maximum and one invalid value during configuration validation. The expected mechanism is: The numeric seconds portion can include three fractional digits derived from subsecond fields. For the science observation, add one near-miss that exposes using a value outside the range or expecting it to accept arbitrary precision. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using a value outside the range or expecting it to accept arbitrary precision.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Test minimum, maximum and one invalid value during configuration validation.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from fractionalDigits ranges from zero to nine?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using a value outside the range or expecting it to accept arbitrary precision be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library visit with minutes for travel, browsing and borrowing. Include one ordinary case, one boundary and one deliberate failure caused by using a value outside the range or expecting it to accept arbitrary precision. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: The fractionalDigits option accepts an integer from zero through nine and controls numeric subsecond precision. It shows a trace, not only a final value. The ordinary case should demonstrate “The numeric seconds portion can include three fractional digits derived from subsecond fields.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Test minimum, maximum and one invalid value during configuration validation. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For fractionalDigits ranges from zero to nine, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 14 OF 20 . Debug and verify

14. Subsecond fields have exact units

Back to contents

Milliseconds, microseconds and nanoseconds are distinct integer fields rather than a single decimal string. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is placing a decimal string in seconds and losing the structured-unit contract. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Convert measured data to explicit integer fields and keep the original measurement policy separate.

For the Subsecond fields have exact units chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on placing a decimal string in seconds and losing the structured-unit contract. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

df.format({milliseconds:12,microseconds:345,nanoseconds:678})

Explained result. The record preserves the three subsecond unit magnitudes for formatting. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: CCA rehearsal. Explain the rule using hours and minutes in a practice block. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Milliseconds, microseconds and nanoseconds are distinct integer fields rather than a single decimal string.” Apply this procedure: Convert measured data to explicit integer fields and keep the original measurement policy separate. The expected mechanism is: The record preserves the three subsecond unit magnitudes for formatting. For the CCA rehearsal, add one near-miss that exposes placing a decimal string in seconds and losing the structured-unit contract. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: science observation. Transfer the rule using seconds, milliseconds and instrument resolution. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Milliseconds, microseconds and nanoseconds are distinct integer fields rather than a single decimal string.” Apply this procedure: Convert measured data to explicit integer fields and keep the original measurement policy separate. The expected mechanism is: The record preserves the three subsecond unit magnitudes for formatting. For the science observation, add one near-miss that exposes placing a decimal string in seconds and losing the structured-unit contract. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: revision plan. Predict the rule using days, hours and short study intervals. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Milliseconds, microseconds and nanoseconds are distinct integer fields rather than a single decimal string.” Apply this procedure: Convert measured data to explicit integer fields and keep the original measurement policy separate. The expected mechanism is: The record preserves the three subsecond unit magnitudes for formatting. For the revision plan, add one near-miss that exposes placing a decimal string in seconds and losing the structured-unit contract. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: family journey. Contrast the rule using hours and minutes across route segments. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Milliseconds, microseconds and nanoseconds are distinct integer fields rather than a single decimal string.” Apply this procedure: Convert measured data to explicit integer fields and keep the original measurement policy separate. The expected mechanism is: The record preserves the three subsecond unit magnitudes for formatting. For the family journey, add one near-miss that exposes placing a decimal string in seconds and losing the structured-unit contract. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers placing a decimal string in seconds and losing the structured-unit contract.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Convert measured data to explicit integer fields and keep the original measurement policy separate.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Subsecond fields have exact units?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing placing a decimal string in seconds and losing the structured-unit contract be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA rehearsal with hours and minutes in a practice block. Include one ordinary case, one boundary and one deliberate failure caused by placing a decimal string in seconds and losing the structured-unit contract. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Milliseconds, microseconds and nanoseconds are distinct integer fields rather than a single decimal string. It shows a trace, not only a final value. The ordinary case should demonstrate “The record preserves the three subsecond unit magnitudes for formatting.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Convert measured data to explicit integer fields and keep the original measurement policy separate. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Subsecond fields have exact units, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 15 OF 20 . Debug and verify

15. format returns an opaque display string

Back to contents

format concatenates locale-sensitive parts into a human-facing string whose punctuation and spacing are not a storage format. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is splitting the result on spaces or colons to recover values. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Keep the original record as data and use the string only for display.

For the format returns an opaque display string chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on splitting the result on spaces or colons to recover values. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const label=df.format({minutes:9,seconds:4});

Explained result. label is presentation; the structured object remains the source of truth. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: revision plan. Transfer the rule using days, hours and short study intervals. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “format concatenates locale-sensitive parts into a human-facing string whose punctuation and spacing are not a storage format.” Apply this procedure: Keep the original record as data and use the string only for display. The expected mechanism is: label is presentation; the structured object remains the source of truth. For the revision plan, add one near-miss that exposes splitting the result on spaces or colons to recover values. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: family journey. Predict the rule using hours and minutes across route segments. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “format concatenates locale-sensitive parts into a human-facing string whose punctuation and spacing are not a storage format.” Apply this procedure: Keep the original record as data and use the string only for display. The expected mechanism is: label is presentation; the structured object remains the source of truth. For the family journey, add one near-miss that exposes splitting the result on spaces or colons to recover values. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: coding benchmark. Contrast the rule using milliseconds, microseconds and display precision. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “format concatenates locale-sensitive parts into a human-facing string whose punctuation and spacing are not a storage format.” Apply this procedure: Keep the original record as data and use the string only for display. The expected mechanism is: label is presentation; the structured object remains the source of truth. For the coding benchmark, add one near-miss that exposes splitting the result on spaces or colons to recover values. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: project countdown. Stress-test the rule using weeks, days and hours remaining. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “format concatenates locale-sensitive parts into a human-facing string whose punctuation and spacing are not a storage format.” Apply this procedure: Keep the original record as data and use the string only for display. The expected mechanism is: label is presentation; the structured object remains the source of truth. For the project countdown, add one near-miss that exposes splitting the result on spaces or colons to recover values. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers splitting the result on spaces or colons to recover values.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Keep the original record as data and use the string only for display.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from format returns an opaque display string?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing splitting the result on spaces or colons to recover values be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science observation with seconds, milliseconds and instrument resolution. Include one ordinary case, one boundary and one deliberate failure caused by splitting the result on spaces or colons to recover values. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: format concatenates locale-sensitive parts into a human-facing string whose punctuation and spacing are not a storage format. It shows a trace, not only a final value. The ordinary case should demonstrate “label is presentation; the structured object remains the source of truth.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Keep the original record as data and use the string only for display. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For format returns an opaque display string, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 16 OF 20 . Debug and verify

16. formatToParts exposes typed pieces

Back to contents

formatToParts returns objects with type and value, and duration-related parts can also carry a unit. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using a regular expression to find numbers in a localised string. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Inspect part types and units, then assemble accessible markup without changing order.

For the formatToParts exposes typed pieces chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on using a regular expression to find numbers in a localised string. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

df.formatToParts({hours:1,minutes:2})

Explained result. The array preserves the formatter’s order while distinguishing numeric, literal and unit-related pieces. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: coding benchmark. Predict the rule using milliseconds, microseconds and display precision. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “formatToParts returns objects with type and value, and duration-related parts can also carry a unit.” Apply this procedure: Inspect part types and units, then assemble accessible markup without changing order. The expected mechanism is: The array preserves the formatter’s order while distinguishing numeric, literal and unit-related pieces. For the coding benchmark, add one near-miss that exposes using a regular expression to find numbers in a localised string. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: project countdown. Contrast the rule using weeks, days and hours remaining. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “formatToParts returns objects with type and value, and duration-related parts can also carry a unit.” Apply this procedure: Inspect part types and units, then assemble accessible markup without changing order. The expected mechanism is: The array preserves the formatter’s order while distinguishing numeric, literal and unit-related pieces. For the project countdown, add one near-miss that exposes using a regular expression to find numbers in a localised string. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework timer. Stress-test the rule using hours, minutes and seconds spent on focused work. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “formatToParts returns objects with type and value, and duration-related parts can also carry a unit.” Apply this procedure: Inspect part types and units, then assemble accessible markup without changing order. The expected mechanism is: The array preserves the formatter’s order while distinguishing numeric, literal and unit-related pieces. For the homework timer, add one near-miss that exposes using a regular expression to find numbers in a localised string. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library visit. Explain the rule using minutes for travel, browsing and borrowing. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “formatToParts returns objects with type and value, and duration-related parts can also carry a unit.” Apply this procedure: Inspect part types and units, then assemble accessible markup without changing order. The expected mechanism is: The array preserves the formatter’s order while distinguishing numeric, literal and unit-related pieces. For the library visit, add one near-miss that exposes using a regular expression to find numbers in a localised string. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using a regular expression to find numbers in a localised string.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Inspect part types and units, then assemble accessible markup without changing order.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from formatToParts exposes typed pieces?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using a regular expression to find numbers in a localised string be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision plan with days, hours and short study intervals. Include one ordinary case, one boundary and one deliberate failure caused by using a regular expression to find numbers in a localised string. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: formatToParts returns objects with type and value, and duration-related parts can also carry a unit. It shows a trace, not only a final value. The ordinary case should demonstrate “The array preserves the formatter’s order while distinguishing numeric, literal and unit-related pieces.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Inspect part types and units, then assemble accessible markup without changing order. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For formatToParts exposes typed pieces, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 17 OF 20 . Transfer with judgment

17. resolvedOptions is the configuration receipt

Back to contents

resolvedOptions reports the resolved locale, numbering system, style and relevant unit settings used by the instance. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is assuming the requested locale or every supplied option survived unchanged. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Log the receipt in tests and assert only the product contract that truly matters.

For the resolvedOptions is the configuration receipt chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on assuming the requested locale or every supplied option survived unchanged. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const options=df.resolvedOptions(); console.log(options.locale,options.style);

Explained result. The values show the actual locale and style used by this formatter. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: homework timer. Contrast the rule using hours, minutes and seconds spent on focused work. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “resolvedOptions reports the resolved locale, numbering system, style and relevant unit settings used by the instance.” Apply this procedure: Log the receipt in tests and assert only the product contract that truly matters. The expected mechanism is: The values show the actual locale and style used by this formatter. For the homework timer, add one near-miss that exposes assuming the requested locale or every supplied option survived unchanged. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: library visit. Stress-test the rule using minutes for travel, browsing and borrowing. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “resolvedOptions reports the resolved locale, numbering system, style and relevant unit settings used by the instance.” Apply this procedure: Log the receipt in tests and assert only the product contract that truly matters. The expected mechanism is: The values show the actual locale and style used by this formatter. For the library visit, add one near-miss that exposes assuming the requested locale or every supplied option survived unchanged. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: CCA rehearsal. Explain the rule using hours and minutes in a practice block. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “resolvedOptions reports the resolved locale, numbering system, style and relevant unit settings used by the instance.” Apply this procedure: Log the receipt in tests and assert only the product contract that truly matters. The expected mechanism is: The values show the actual locale and style used by this formatter. For the CCA rehearsal, add one near-miss that exposes assuming the requested locale or every supplied option survived unchanged. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: science observation. Transfer the rule using seconds, milliseconds and instrument resolution. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “resolvedOptions reports the resolved locale, numbering system, style and relevant unit settings used by the instance.” Apply this procedure: Log the receipt in tests and assert only the product contract that truly matters. The expected mechanism is: The values show the actual locale and style used by this formatter. For the science observation, add one near-miss that exposes assuming the requested locale or every supplied option survived unchanged. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers assuming the requested locale or every supplied option survived unchanged.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Log the receipt in tests and assert only the product contract that truly matters.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from resolvedOptions is the configuration receipt?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming the requested locale or every supplied option survived unchanged be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family journey with hours and minutes across route segments. Include one ordinary case, one boundary and one deliberate failure caused by assuming the requested locale or every supplied option survived unchanged. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: resolvedOptions reports the resolved locale, numbering system, style and relevant unit settings used by the instance. It shows a trace, not only a final value. The ordinary case should demonstrate “The values show the actual locale and style used by this formatter.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Log the receipt in tests and assert only the product contract that truly matters. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For resolvedOptions is the configuration receipt, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 18 OF 20 . Transfer with judgment

18. Feature detection belongs at the boundary

Back to contents

A deployment should check whether Intl.DurationFormat exists in the target runtime before relying on it. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is inferring universal support from one development machine. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Detect the constructor and choose a documented fallback without pretending the fallback is identical.

For the Feature detection belongs at the boundary chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on inferring universal support from one development machine. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const supported=typeof Intl.DurationFormat==='function';

Explained result. supported states whether this runtime exposes the constructor. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: CCA rehearsal. Stress-test the rule using hours and minutes in a practice block. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A deployment should check whether Intl.DurationFormat exists in the target runtime before relying on it.” Apply this procedure: Detect the constructor and choose a documented fallback without pretending the fallback is identical. The expected mechanism is: supported states whether this runtime exposes the constructor. For the CCA rehearsal, add one near-miss that exposes inferring universal support from one development machine. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: science observation. Explain the rule using seconds, milliseconds and instrument resolution. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A deployment should check whether Intl.DurationFormat exists in the target runtime before relying on it.” Apply this procedure: Detect the constructor and choose a documented fallback without pretending the fallback is identical. The expected mechanism is: supported states whether this runtime exposes the constructor. For the science observation, add one near-miss that exposes inferring universal support from one development machine. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: revision plan. Transfer the rule using days, hours and short study intervals. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A deployment should check whether Intl.DurationFormat exists in the target runtime before relying on it.” Apply this procedure: Detect the constructor and choose a documented fallback without pretending the fallback is identical. The expected mechanism is: supported states whether this runtime exposes the constructor. For the revision plan, add one near-miss that exposes inferring universal support from one development machine. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: family journey. Predict the rule using hours and minutes across route segments. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A deployment should check whether Intl.DurationFormat exists in the target runtime before relying on it.” Apply this procedure: Detect the constructor and choose a documented fallback without pretending the fallback is identical. The expected mechanism is: supported states whether this runtime exposes the constructor. For the family journey, add one near-miss that exposes inferring universal support from one development machine. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers inferring universal support from one development machine.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Detect the constructor and choose a documented fallback without pretending the fallback is identical.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Feature detection belongs at the boundary?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing inferring universal support from one development machine be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny coding benchmark with milliseconds, microseconds and display precision. Include one ordinary case, one boundary and one deliberate failure caused by inferring universal support from one development machine. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: A deployment should check whether Intl.DurationFormat exists in the target runtime before relying on it. It shows a trace, not only a final value. The ordinary case should demonstrate “supported states whether this runtime exposes the constructor.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Detect the constructor and choose a documented fallback without pretending the fallback is identical. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Feature detection belongs at the boundary, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 19 OF 20 . Transfer with judgment

19. Tests should avoid accidental locale assumptions

Back to contents

Exact strings can vary across locales and runtime data, so tests must fix the locale or assert meaningful parts. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is snapshotting one machine’s punctuation as a universal standard. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Test a fixed supported locale and use formatToParts for structural assertions when appropriate.

For the Tests should avoid accidental locale assumptions chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on snapshotting one machine’s punctuation as a universal standard. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const parts=new Intl.DurationFormat('en',{style:'long'}).formatToParts({hours:2});

Explained result. The test can assert an hour unit and the numeric value without parsing unrelated punctuation. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: revision plan. Explain the rule using days, hours and short study intervals. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Exact strings can vary across locales and runtime data, so tests must fix the locale or assert meaningful parts.” Apply this procedure: Test a fixed supported locale and use formatToParts for structural assertions when appropriate. The expected mechanism is: The test can assert an hour unit and the numeric value without parsing unrelated punctuation. For the revision plan, add one near-miss that exposes snapshotting one machine’s punctuation as a universal standard. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: family journey. Transfer the rule using hours and minutes across route segments. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Exact strings can vary across locales and runtime data, so tests must fix the locale or assert meaningful parts.” Apply this procedure: Test a fixed supported locale and use formatToParts for structural assertions when appropriate. The expected mechanism is: The test can assert an hour unit and the numeric value without parsing unrelated punctuation. For the family journey, add one near-miss that exposes snapshotting one machine’s punctuation as a universal standard. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: coding benchmark. Predict the rule using milliseconds, microseconds and display precision. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Exact strings can vary across locales and runtime data, so tests must fix the locale or assert meaningful parts.” Apply this procedure: Test a fixed supported locale and use formatToParts for structural assertions when appropriate. The expected mechanism is: The test can assert an hour unit and the numeric value without parsing unrelated punctuation. For the coding benchmark, add one near-miss that exposes snapshotting one machine’s punctuation as a universal standard. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: project countdown. Contrast the rule using weeks, days and hours remaining. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Exact strings can vary across locales and runtime data, so tests must fix the locale or assert meaningful parts.” Apply this procedure: Test a fixed supported locale and use formatToParts for structural assertions when appropriate. The expected mechanism is: The test can assert an hour unit and the numeric value without parsing unrelated punctuation. For the project countdown, add one near-miss that exposes snapshotting one machine’s punctuation as a universal standard. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers snapshotting one machine’s punctuation as a universal standard.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Test a fixed supported locale and use formatToParts for structural assertions when appropriate.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Tests should avoid accidental locale assumptions?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing snapshotting one machine’s punctuation as a universal standard be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny project countdown with weeks, days and hours remaining. Include one ordinary case, one boundary and one deliberate failure caused by snapshotting one machine’s punctuation as a universal standard. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Exact strings can vary across locales and runtime data, so tests must fix the locale or assert meaningful parts. It shows a trace, not only a final value. The ordinary case should demonstrate “The test can assert an hour unit and the numeric value without parsing unrelated punctuation.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Test a fixed supported locale and use formatToParts for structural assertions when appropriate. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Tests should avoid accidental locale assumptions, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

CHAPTER 20 OF 20 . Transfer with judgment

20. Choose DurationFormat after arithmetic

Back to contents

Use Intl.DurationFormat when the application already has a valid structured duration and needs localised presentation. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using it as a date-difference engine, timer or duration parser. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State the arithmetic owner, record normalisation rule, locale policy and fallback before construction.

For the Choose DurationFormat after arithmetic chapter on JavaScript Intl.DurationFormat, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on using it as a date-difference engine, timer or duration parser. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const record={hours:1,minutes:45}; const text=new Intl.DurationFormat('en-SG',{style:'long'}).format(record);

Explained result. The calculation and display responsibilities remain separate and auditable. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: coding benchmark. Transfer the rule using milliseconds, microseconds and display precision. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use Intl.DurationFormat when the application already has a valid structured duration and needs localised presentation.” Apply this procedure: State the arithmetic owner, record normalisation rule, locale policy and fallback before construction. The expected mechanism is: The calculation and display responsibilities remain separate and auditable. For the coding benchmark, add one near-miss that exposes using it as a date-difference engine, timer or duration parser. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 2: project countdown. Predict the rule using weeks, days and hours remaining. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use Intl.DurationFormat when the application already has a valid structured duration and needs localised presentation.” Apply this procedure: State the arithmetic owner, record normalisation rule, locale policy and fallback before construction. The expected mechanism is: The calculation and display responsibilities remain separate and auditable. For the project countdown, add one near-miss that exposes using it as a date-difference engine, timer or duration parser. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 3: homework timer. Contrast the rule using hours, minutes and seconds spent on focused work. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use Intl.DurationFormat when the application already has a valid structured duration and needs localised presentation.” Apply this procedure: State the arithmetic owner, record normalisation rule, locale policy and fallback before construction. The expected mechanism is: The calculation and display responsibilities remain separate and auditable. For the homework timer, add one near-miss that exposes using it as a date-difference engine, timer or duration parser. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Case 4: library visit. Stress-test the rule using minutes for travel, browsing and borrowing. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “Use Intl.DurationFormat when the application already has a valid structured duration and needs localised presentation.” Apply this procedure: State the arithmetic owner, record normalisation rule, locale policy and fallback before construction. The expected mechanism is: The calculation and display responsibilities remain separate and auditable. For the library visit, add one near-miss that exposes using it as a date-difference engine, timer or duration parser. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers using it as a date-difference engine, timer or duration parser.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State the arithmetic owner, record normalisation rule, locale policy and fallback before construction.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.DurationFormat syntax. For this chapter, useful prompts are: “What did you expect from Choose DurationFormat after arithmetic?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using it as a date-difference engine, timer or duration parser be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny homework timer with hours, minutes and seconds spent on focused work. Include one ordinary case, one boundary and one deliberate failure caused by using it as a date-difference engine, timer or duration parser. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: Use Intl.DurationFormat when the application already has a valid structured duration and needs localised presentation. It shows a trace, not only a final value. The ordinary case should demonstrate “The calculation and display responsibilities remain separate and auditable.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State the arithmetic owner, record normalisation rule, locale policy and fallback before construction. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Choose DurationFormat after arithmetic, separate the documented JavaScript Intl.DurationFormat mechanism from the project policy. State exactly what the technical contract guarantees, then state the project choice about validation, ordering, ownership, performance or recovery. Test whether the same distinction survives one transfer case, and keep stateful experiments disposable and backed up.

Previous chapter . Contents . Next chapter

Parent guide: choose the next useful step

Start with evidence, not a label such as careless. Ask for one prediction and one trace. If the first transition is wrong, rebuild the model. If the model is sound but syntax fails, practise reference use. If routine cases are correct but boundaries fail, vary ties, defaults, unsupported inputs, ownership or missing paths. If explanations transfer, move to a small project.

Keep a weekly record with four lines: concept, prediction, observed difference and next test. Stop when fatigue replaces reasoning. A smaller case tomorrow is more useful than another hour of copying tonight.

Seek specialist help when cause and effect remain invisible after examples are reduced, when accessibility or data-loss implications are unclear, or when an important repository, database or application state may be at risk. Good support should make the learner’s reasoning more independent.

Capstone practice with explained routes

1. homework timer: model, boundary and recovery

Create a small homework timer using hours, minutes and seconds spent on focused work. Combine “Duration formatting is presentation” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: Intl.DurationFormat receives duration fields and formats them; it does not compute the fields from timestamps. Apply: Calculate or obtain a duration record first, then give that record to the formatter. Verify: The formatter presents one hour and thirty minutes according to the resolved English conventions. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

2. library visit: model, boundary and recovery

Create a small library visit using minutes for travel, browsing and borrowing. Combine “At least one field is required” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: An object with none of the recognised duration properties is rejected instead of formatting as an empty duration. Apply: Validate the record shape before formatting and include an explicit zero field when zero is meaningful. Verify: The record has a recognised field and can produce the formatter’s zero-second representation. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

3. CCA rehearsal: model, boundary and recovery

Create a small CCA rehearsal using hours and minutes in a practice block. Combine “Locale negotiation changes language” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: The locales argument requests language and regional conventions, while the runtime resolves an available locale. Apply: Compare supportedLocalesOf and resolvedOptions before making output assertions. Verify: The visible unit wording follows the resolved French locale rather than an English template. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

4. science observation: model, boundary and recovery

Create a small science observation using seconds, milliseconds and instrument resolution. Combine “Digital is a coordinated style” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: Digital style uses locale data for hour-minute and minute-second separators and coordinated numeric field defaults. Apply: Let the formatter choose separators and two-digit behavior, then test exact target locales. Verify: The output is a locale-aware digital duration rather than a manually joined trio. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

5. revision plan: model, boundary and recovery

Create a small revision plan using days, hours and short study intervals. Combine “fractionalDigits ranges from zero to nine” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: The fractionalDigits option accepts an integer from zero through nine and controls numeric subsecond precision. Apply: Test minimum, maximum and one invalid value during configuration validation. Verify: The numeric seconds portion can include three fractional digits derived from subsecond fields. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

6. family journey: model, boundary and recovery

Create a small family journey using hours and minutes across route segments. Combine “formatToParts exposes typed pieces” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: formatToParts returns objects with type and value, and duration-related parts can also carry a unit. Apply: Inspect part types and units, then assemble accessible markup without changing order. Verify: The array preserves the formatter’s order while distinguishing numeric, literal and unit-related pieces. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

7. coding benchmark: model, boundary and recovery

Create a small coding benchmark using milliseconds, microseconds and display precision. Combine “Tests should avoid accidental locale assumptions” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: Exact strings can vary across locales and runtime data, so tests must fix the locale or assert meaningful parts. Apply: Test a fixed supported locale and use formatToParts for structural assertions when appropriate. Verify: The test can assert an hour unit and the numeric value without parsing unrelated punctuation. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

8. project countdown: model, boundary and recovery

Create a small project countdown using weeks, days and hours remaining. Combine “Construct with new” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: The specification requires Intl.DurationFormat to be constructed; calling it without new throws TypeError. Apply: Use new and make the construction step visible in examples and factories. Verify: df is an initialized duration formatter for a resolved locale. Then add a second chapter whose boundary could change the outcome. A complete solution contains the input model, a trace, observed evidence, a correction and one transfer statement. The exact data may differ; the causal chain must be checkable.

Frequently asked questions

How long should a practice session be?

Use one complete prediction–observation–explanation cycle while attention remains good. Ten to twenty focused minutes can be enough.

Should every option or function be memorised?

No. Memorise the governing distinctions and practise retrieving the official reference. Understanding means predicting and explaining, not reciting a parameter list.

What if the result is correct but the explanation is weak?

Treat it as partial success. Ask for a trace and change one boundary. A reliable model survives controlled variation.

Is the shortest solution the best?

Not automatically. Prefer the solution whose semantics, failure modes and maintenance cost are easiest to justify for the actual project.

When should official documentation be used?

Use it whenever syntax, supported types, SQL dialect behaviour or Git version details matter. Primary documentation settles the current contract.

How can a parent help without technical expertise?

Ask what was predicted, where the first difference appeared, what evidence matters and which smaller example could isolate it.

How do we test transfer?

Change the context, vocabulary and one boundary. Require the learner to identify the invariant before using a tool.

What should be saved after practice?

Keep the corrected rule, one trace, one boundary case and the next question. Avoid storing pages of unexplained output.

Can these exercises replace backups?

No. Use disposable examples and proper backups. Learning should not endanger schoolwork, repositories or personal data.

What counts as mastery?

The learner can predict, verify, diagnose, recover and justify a choice across more than one context, while knowing when to consult the current reference.

Official and supporting references

Return to contents

Continue from here: Start Here · Tuition · Education · Pathways · Parenting 101 · All Site Routes

eduKate Punggol

Contact

83 Punggol Central, Singapore 828761

edu|Kate Bukit Timah

8 Fourth Avenue, Singapore 268674

By Appointment +65 8823 1234
admin@edukatesg.com

Email Us

When a child finally understands, school becomes less frightening and the future opens wider. Email us for the latest schedules and fees.

← 返回

感谢您的回复。 ✨

了解 eduKate Punggol 的更多信息

立即订阅以继续阅读并访问完整档案。

继续阅读