Small Group Tutorials

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

How to Master JavaScript Intl.NumberFormat in Punggol Tuition

A student rests her chin on one hand while holding a Science textbook, with a bright corridor in the background.

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.NumberFormat turns a numeric value into a locale-sensitive display string according to a resolved locale and a precise option set. It is a formatter, not a parser or a currency converter. Mastery means separating the stored number from its presentation, predicting interacting digit and rounding options, inspecting resolvedOptions and formatToParts, and testing version-sensitive features in the target runtime. 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. Formatting is presentation, not arithmetic

Back to contents

Intl.NumberFormat formats an existing mathematical value; it does not convert currencies or change the underlying number. 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 showing SGD and USD symbols around the same number and calling that exchange conversion. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Separate value calculation, currency identity and final display into three steps.

For the Formatting is presentation, not arithmetic chapter on JavaScript Intl.NumberFormat, 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 showing SGD and USD symbols around the same number and calling that exchange conversion. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const value=12.5; new Intl.NumberFormat('en-SG',{style:'currency',currency:'SGD'}).format(value)

Explained result. The result is a Singapore-dollar display of 12.5, not a converted amount. 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: canteen budget. Predict the rule using Singapore-dollar amounts and percentages. 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.NumberFormat formats an existing mathematical value; it does not convert currencies or change the underlying number.” Apply this procedure: Separate value calculation, currency identity and final display into three steps. The expected mechanism is: The result is a Singapore-dollar display of 12.5, not a converted amount. For the canteen budget, add one near-miss that exposes showing SGD and USD symbols around the same number and calling that exchange conversion. 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 dashboard. Contrast the rule using loan counts in several interface locales. 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.NumberFormat formats an existing mathematical value; it does not convert currencies or change the underlying number.” Apply this procedure: Separate value calculation, currency identity and final display into three steps. The expected mechanism is: The result is a Singapore-dollar display of 12.5, not a converted amount. For the library dashboard, add one near-miss that exposes showing SGD and USD symbols around the same number and calling that exchange conversion. 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 fundraiser. Stress-test the rule using currency totals, targets and compact summaries. 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.NumberFormat formats an existing mathematical value; it does not convert currencies or change the underlying number.” Apply this procedure: Separate value calculation, currency identity and final display into three steps. The expected mechanism is: The result is a Singapore-dollar display of 12.5, not a converted amount. For the CCA fundraiser, add one near-miss that exposes showing SGD and USD symbols around the same number and calling that exchange conversion. 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 display. Explain the rule using measurements with unit labels and controlled 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 “Intl.NumberFormat formats an existing mathematical value; it does not convert currencies or change the underlying number.” Apply this procedure: Separate value calculation, currency identity and final display into three steps. The expected mechanism is: The result is a Singapore-dollar display of 12.5, not a converted amount. For the science display, add one near-miss that exposes showing SGD and USD symbols around the same number and calling that exchange conversion. 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 showing SGD and USD symbols around the same number and calling that exchange conversion.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Separate value calculation, currency identity and final display into three steps.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Formatting is presentation, not arithmetic?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing showing SGD and USD symbols around the same number and calling that exchange conversion be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family planner with cost ranges and accounting-style negatives. Include one ordinary case, one boundary and one deliberate failure caused by showing SGD and USD symbols around the same number and calling that exchange conversion. 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.NumberFormat formats an existing mathematical value; it does not convert currencies or change the underlying number. It shows a trace, not only a final value. The ordinary case should demonstrate “The result is a Singapore-dollar display of 12.5, not a converted amount.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Separate value calculation, currency identity and final display into three steps. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Formatting is presentation, not arithmetic, separate the documented JavaScript Intl.NumberFormat 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. Locale negotiation chooses an available locale

Back to contents

The runtime canonicalises requested locales and resolves a supported locale using the selected locale-matching policy. 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 first requested language tag is always used exactly. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Call supportedLocalesOf and inspect resolvedOptions().locale in the target runtime.

For the Locale negotiation chooses an available locale chapter on JavaScript Intl.NumberFormat, 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 first requested language tag is always used exactly. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const nf=new Intl.NumberFormat(['ban','id','en-SG']);
nf.resolvedOptions().locale

Explained result. The resolved locale is implementation data selected from the requested list and available locale set. 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 fundraiser. Contrast the rule using currency totals, targets and compact summaries. 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 runtime canonicalises requested locales and resolves a supported locale using the selected locale-matching policy.” Apply this procedure: Call supportedLocalesOf and inspect resolvedOptions().locale in the target runtime. The expected mechanism is: The resolved locale is implementation data selected from the requested list and available locale set. For the CCA fundraiser, add one near-miss that exposes assuming the first requested language tag is always used exactly. 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 display. Stress-test the rule using measurements with unit labels and controlled 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 runtime canonicalises requested locales and resolves a supported locale using the selected locale-matching policy.” Apply this procedure: Call supportedLocalesOf and inspect resolvedOptions().locale in the target runtime. The expected mechanism is: The resolved locale is implementation data selected from the requested list and available locale set. For the science display, add one near-miss that exposes assuming the first requested language tag is always used exactly. 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 tracker. Explain the rule using scores, ratios and percentage progress. 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 runtime canonicalises requested locales and resolves a supported locale using the selected locale-matching policy.” Apply this procedure: Call supportedLocalesOf and inspect resolvedOptions().locale in the target runtime. The expected mechanism is: The resolved locale is implementation data selected from the requested list and available locale set. For the revision tracker, add one near-miss that exposes assuming the first requested language tag is always used exactly. 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 planner. Transfer the rule using cost ranges and accounting-style negatives. 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 runtime canonicalises requested locales and resolves a supported locale using the selected locale-matching policy.” Apply this procedure: Call supportedLocalesOf and inspect resolvedOptions().locale in the target runtime. The expected mechanism is: The resolved locale is implementation data selected from the requested list and available locale set. For the family planner, add one near-miss that exposes assuming the first requested language tag is always used exactly. 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 first requested language tag is always used exactly.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Call supportedLocalesOf and inspect resolvedOptions().locale in the target runtime.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Locale negotiation chooses an available locale?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming the first requested language tag is always used exactly be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny travel exercise with the same number formatted for several requested locales. Include one ordinary case, one boundary and one deliberate failure caused by assuming the first requested language tag is always used exactly. 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 runtime canonicalises requested locales and resolves a supported locale using the selected locale-matching policy. It shows a trace, not only a final value. The ordinary case should demonstrate “The resolved locale is implementation data selected from the requested list and available locale set.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Call supportedLocalesOf and inspect resolvedOptions().locale in the target runtime. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Locale negotiation chooses an available locale, separate the documented JavaScript Intl.NumberFormat 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. Decimal style is the default

Back to contents

With no style option, NumberFormat uses decimal formatting with locale data and default digit 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 reading grouping or punctuation as part of the numeric value. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Compare format output with the original number and resolved options.

For the Decimal style is the default chapter on JavaScript Intl.NumberFormat, 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 reading grouping or punctuation as part of the numeric value. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.NumberFormat('en-SG').format(1234567.89)

Explained result. The number remains 1234567.89; only its display receives locale-sensitive separators. 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 tracker. Stress-test the rule using scores, ratios and percentage progress. 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 “With no style option, NumberFormat uses decimal formatting with locale data and default digit rules.” Apply this procedure: Compare format output with the original number and resolved options. The expected mechanism is: The number remains 1234567.89; only its display receives locale-sensitive separators. For the revision tracker, add one near-miss that exposes reading grouping or punctuation as part of the numeric value. 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 planner. Explain the rule using cost ranges and accounting-style negatives. 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 “With no style option, NumberFormat uses decimal formatting with locale data and default digit rules.” Apply this procedure: Compare format output with the original number and resolved options. The expected mechanism is: The number remains 1234567.89; only its display receives locale-sensitive separators. For the family planner, add one near-miss that exposes reading grouping or punctuation as part of the numeric value. 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: travel exercise. Transfer the rule using the same number formatted for several requested locales. 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 “With no style option, NumberFormat uses decimal formatting with locale data and default digit rules.” Apply this procedure: Compare format output with the original number and resolved options. The expected mechanism is: The number remains 1234567.89; only its display receives locale-sensitive separators. For the travel exercise, add one near-miss that exposes reading grouping or punctuation as part of the numeric value. 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: compatibility lab. Predict the rule using feature detection, resolved options and exact part arrays. 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 “With no style option, NumberFormat uses decimal formatting with locale data and default digit rules.” Apply this procedure: Compare format output with the original number and resolved options. The expected mechanism is: The number remains 1234567.89; only its display receives locale-sensitive separators. For the compatibility lab, add one near-miss that exposes reading grouping or punctuation as part of the numeric value. 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 reading grouping or punctuation as part of the numeric value.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Compare format output with the original number and resolved options.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Decimal style is the default?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing reading grouping or punctuation as part of the numeric value be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny compatibility lab with feature detection, resolved options and exact part arrays. Include one ordinary case, one boundary and one deliberate failure caused by reading grouping or punctuation as part of the numeric value. 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: With no style option, NumberFormat uses decimal formatting with locale data and default digit rules. It shows a trace, not only a final value. The ordinary case should demonstrate “The number remains 1234567.89; only its display receives locale-sensitive separators.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Compare format output with the original number and resolved options. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Decimal style is the default, separate the documented JavaScript Intl.NumberFormat 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. Percent style scales for display

Back to contents

Percent formatting represents the numeric input as a percentage, so 0.25 displays as twenty-five percent in ordinary settings. 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 25 when the stored ratio is 0.25 and accidentally displaying 2,500 percent. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Write whether the domain stores a ratio or percentage points before formatting.

For the Percent style scales for display chapter on JavaScript Intl.NumberFormat, 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 25 when the stored ratio is 0.25 and accidentally displaying 2,500 percent. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.NumberFormat('en-SG',{style:'percent'}).format(0.25)

Explained result. The display is 25% under ordinary en-SG locale data. 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: travel exercise. Explain the rule using the same number formatted for several requested locales. 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 “Percent formatting represents the numeric input as a percentage, so 0.25 displays as twenty-five percent in ordinary settings.” Apply this procedure: Write whether the domain stores a ratio or percentage points before formatting. The expected mechanism is: The display is 25% under ordinary en-SG locale data. For the travel exercise, add one near-miss that exposes passing 25 when the stored ratio is 0.25 and accidentally displaying 2,500 percent. 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: compatibility lab. Transfer the rule using feature detection, resolved options and exact part arrays. 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 “Percent formatting represents the numeric input as a percentage, so 0.25 displays as twenty-five percent in ordinary settings.” Apply this procedure: Write whether the domain stores a ratio or percentage points before formatting. The expected mechanism is: The display is 25% under ordinary en-SG locale data. For the compatibility lab, add one near-miss that exposes passing 25 when the stored ratio is 0.25 and accidentally displaying 2,500 percent. 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: canteen budget. Predict the rule using Singapore-dollar amounts and percentages. 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 “Percent formatting represents the numeric input as a percentage, so 0.25 displays as twenty-five percent in ordinary settings.” Apply this procedure: Write whether the domain stores a ratio or percentage points before formatting. The expected mechanism is: The display is 25% under ordinary en-SG locale data. For the canteen budget, add one near-miss that exposes passing 25 when the stored ratio is 0.25 and accidentally displaying 2,500 percent. 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 dashboard. Contrast the rule using loan counts in several interface locales. 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 “Percent formatting represents the numeric input as a percentage, so 0.25 displays as twenty-five percent in ordinary settings.” Apply this procedure: Write whether the domain stores a ratio or percentage points before formatting. The expected mechanism is: The display is 25% under ordinary en-SG locale data. For the library dashboard, add one near-miss that exposes passing 25 when the stored ratio is 0.25 and accidentally displaying 2,500 percent. 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 25 when the stored ratio is 0.25 and accidentally displaying 2,500 percent.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Write whether the domain stores a ratio or percentage points 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Percent style scales for display?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing passing 25 when the stored ratio is 0.25 and accidentally displaying 2,500 percent be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny canteen budget with Singapore-dollar amounts and percentages. Include one ordinary case, one boundary and one deliberate failure caused by passing 25 when the stored ratio is 0.25 and accidentally displaying 2,500 percent. 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: Percent formatting represents the numeric input as a percentage, so 0.25 displays as twenty-five percent in ordinary settings. It shows a trace, not only a final value. The ordinary case should demonstrate “The display is 25% under ordinary en-SG locale data.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Write whether the domain stores a ratio or percentage points before formatting. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Percent style scales for display, separate the documented JavaScript Intl.NumberFormat 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. Currency requires an explicit code

Back to contents

Currency style requires a well-formed currency option, and the code controls currency-specific defaults such as ordinary minor-unit digits. 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 currency from the locale or treating the symbol as unambiguous. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Store an ISO currency code with the amount and pass it explicitly.

For the Currency requires an explicit code chapter on JavaScript Intl.NumberFormat, 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 currency from the locale or treating the symbol as unambiguous. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.NumberFormat('en-SG',{style:'currency',currency:'SGD'}).format(18)

Explained result. The formatter presents eighteen Singapore dollars according to resolved locale data. 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: canteen budget. Transfer the rule using Singapore-dollar amounts and percentages. 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 “Currency style requires a well-formed currency option, and the code controls currency-specific defaults such as ordinary minor-unit digits.” Apply this procedure: Store an ISO currency code with the amount and pass it explicitly. The expected mechanism is: The formatter presents eighteen Singapore dollars according to resolved locale data. For the canteen budget, add one near-miss that exposes inferring currency from the locale or treating the symbol as unambiguous. 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 dashboard. Predict the rule using loan counts in several interface locales. 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 “Currency style requires a well-formed currency option, and the code controls currency-specific defaults such as ordinary minor-unit digits.” Apply this procedure: Store an ISO currency code with the amount and pass it explicitly. The expected mechanism is: The formatter presents eighteen Singapore dollars according to resolved locale data. For the library dashboard, add one near-miss that exposes inferring currency from the locale or treating the symbol as unambiguous. 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 fundraiser. Contrast the rule using currency totals, targets and compact summaries. 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 “Currency style requires a well-formed currency option, and the code controls currency-specific defaults such as ordinary minor-unit digits.” Apply this procedure: Store an ISO currency code with the amount and pass it explicitly. The expected mechanism is: The formatter presents eighteen Singapore dollars according to resolved locale data. For the CCA fundraiser, add one near-miss that exposes inferring currency from the locale or treating the symbol as unambiguous. 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 display. Stress-test the rule using measurements with unit labels and controlled 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 “Currency style requires a well-formed currency option, and the code controls currency-specific defaults such as ordinary minor-unit digits.” Apply this procedure: Store an ISO currency code with the amount and pass it explicitly. The expected mechanism is: The formatter presents eighteen Singapore dollars according to resolved locale data. For the science display, add one near-miss that exposes inferring currency from the locale or treating the symbol as unambiguous. 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 currency from the locale or treating the symbol as unambiguous.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Store an ISO currency code with the amount and pass it 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Currency requires an explicit code?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing inferring currency from the locale or treating the symbol as unambiguous be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library dashboard with loan counts in several interface locales. Include one ordinary case, one boundary and one deliberate failure caused by inferring currency from the locale or treating the symbol as unambiguous. 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: Currency style requires a well-formed currency option, and the code controls currency-specific defaults such as ordinary minor-unit digits. It shows a trace, not only a final value. The ordinary case should demonstrate “The formatter presents eighteen Singapore dollars according to resolved locale data.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Store an ISO currency code with the amount and pass it explicitly. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Currency requires an explicit code, separate the documented JavaScript Intl.NumberFormat 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. currencyDisplay controls the label form

Back to contents

currencyDisplay selects symbol, narrowSymbol, code or name without changing the numeric amount. 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 symbol alone where several currencies could be confused. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Choose code or name when clarity matters more than compactness.

For the currencyDisplay controls the label form chapter on JavaScript Intl.NumberFormat, 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 symbol alone where several currencies could be confused. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.NumberFormat('en-SG',{style:'currency',currency:'USD',currencyDisplay:'code'}).format(20)

Explained result. The display includes USD rather than relying only on a dollar sign. 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 fundraiser. Predict the rule using currency totals, targets and compact summaries. 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 “currencyDisplay selects symbol, narrowSymbol, code or name without changing the numeric amount.” Apply this procedure: Choose code or name when clarity matters more than compactness. The expected mechanism is: The display includes USD rather than relying only on a dollar sign. For the CCA fundraiser, add one near-miss that exposes using a symbol alone where several currencies could be confused. 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 display. Contrast the rule using measurements with unit labels and controlled 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 “currencyDisplay selects symbol, narrowSymbol, code or name without changing the numeric amount.” Apply this procedure: Choose code or name when clarity matters more than compactness. The expected mechanism is: The display includes USD rather than relying only on a dollar sign. For the science display, add one near-miss that exposes using a symbol alone where several currencies could be confused. 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 tracker. Stress-test the rule using scores, ratios and percentage progress. 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 “currencyDisplay selects symbol, narrowSymbol, code or name without changing the numeric amount.” Apply this procedure: Choose code or name when clarity matters more than compactness. The expected mechanism is: The display includes USD rather than relying only on a dollar sign. For the revision tracker, add one near-miss that exposes using a symbol alone where several currencies could be confused. 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 planner. Explain the rule using cost ranges and accounting-style negatives. 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 “currencyDisplay selects symbol, narrowSymbol, code or name without changing the numeric amount.” Apply this procedure: Choose code or name when clarity matters more than compactness. The expected mechanism is: The display includes USD rather than relying only on a dollar sign. For the family planner, add one near-miss that exposes using a symbol alone where several currencies could be confused. 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 symbol alone where several currencies could be confused.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Choose code or name when clarity matters more than compactness.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from currencyDisplay controls the label form?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using a symbol alone where several currencies could be confused be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA fundraiser with currency totals, targets and compact summaries. Include one ordinary case, one boundary and one deliberate failure caused by using a symbol alone where several currencies could be confused. 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: currencyDisplay selects symbol, narrowSymbol, code or name without changing the numeric amount. It shows a trace, not only a final value. The ordinary case should demonstrate “The display includes USD rather than relying only on a dollar sign.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Choose code or name when clarity matters more than compactness. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For currencyDisplay controls the label form, separate the documented JavaScript Intl.NumberFormat 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. Unit style names a measurement

Back to contents

Unit formatting requires a sanctioned unit identifier and can use long, short or narrow display forms. 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 unit formatter to convert kilometres into metres. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Convert the numeric value separately, then format it with the correct unit.

For the Unit style names a measurement chapter on JavaScript Intl.NumberFormat, 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 unit formatter to convert kilometres into metres. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.NumberFormat('en-SG',{style:'unit',unit:'kilometer-per-hour',unitDisplay:'long'}).format(12)

Explained result. The output labels twelve kilometres per hour; no measurement conversion occurs. 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 tracker. Contrast the rule using scores, ratios and percentage progress. 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 formatting requires a sanctioned unit identifier and can use long, short or narrow display forms.” Apply this procedure: Convert the numeric value separately, then format it with the correct unit. The expected mechanism is: The output labels twelve kilometres per hour; no measurement conversion occurs. For the revision tracker, add one near-miss that exposes using a unit formatter to convert kilometres into metres. 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 planner. Stress-test the rule using cost ranges and accounting-style negatives. 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 formatting requires a sanctioned unit identifier and can use long, short or narrow display forms.” Apply this procedure: Convert the numeric value separately, then format it with the correct unit. The expected mechanism is: The output labels twelve kilometres per hour; no measurement conversion occurs. For the family planner, add one near-miss that exposes using a unit formatter to convert kilometres into metres. 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: travel exercise. Explain the rule using the same number formatted for several requested locales. 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 formatting requires a sanctioned unit identifier and can use long, short or narrow display forms.” Apply this procedure: Convert the numeric value separately, then format it with the correct unit. The expected mechanism is: The output labels twelve kilometres per hour; no measurement conversion occurs. For the travel exercise, add one near-miss that exposes using a unit formatter to convert kilometres into metres. 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: compatibility lab. Transfer the rule using feature detection, resolved options and exact part arrays. 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 formatting requires a sanctioned unit identifier and can use long, short or narrow display forms.” Apply this procedure: Convert the numeric value separately, then format it with the correct unit. The expected mechanism is: The output labels twelve kilometres per hour; no measurement conversion occurs. For the compatibility lab, add one near-miss that exposes using a unit formatter to convert kilometres into metres. 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 unit formatter to convert kilometres into metres.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Convert the numeric value separately, then format it with the correct unit.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Unit style names a measurement?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using a unit formatter to convert kilometres into metres be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science display with measurements with unit labels and controlled precision. Include one ordinary case, one boundary and one deliberate failure caused by using a unit formatter to convert kilometres into metres. 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 formatting requires a sanctioned unit identifier and can use long, short or narrow display forms. It shows a trace, not only a final value. The ordinary case should demonstrate “The output labels twelve kilometres per hour; no measurement conversion occurs.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Convert the numeric value separately, then format it with the correct unit. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Unit style names a measurement, separate the documented JavaScript Intl.NumberFormat 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. Fraction-digit defaults interact

Back to contents

minimumFractionDigits and maximumFractionDigits are resolved together, and specifying one can affect the default of the other. 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 setting only one digit option and assuming every other default stays unrelated. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Inspect resolvedOptions and test values below, at and above the intended precision.

For the Fraction-digit defaults interact chapter on JavaScript Intl.NumberFormat, 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 setting only one digit option and assuming every other default stays unrelated. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const nf=new Intl.NumberFormat('en-SG',{minimumFractionDigits:2});
nf.resolvedOptions()

Explained result. The resolved maximum fraction digits is part of the effective contract and should be inspected rather than guessed. 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: travel exercise. Stress-test the rule using the same number formatted for several requested locales. 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 “minimumFractionDigits and maximumFractionDigits are resolved together, and specifying one can affect the default of the other.” Apply this procedure: Inspect resolvedOptions and test values below, at and above the intended precision. The expected mechanism is: The resolved maximum fraction digits is part of the effective contract and should be inspected rather than guessed. For the travel exercise, add one near-miss that exposes setting only one digit option and assuming every other default stays unrelated. 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: compatibility lab. Explain the rule using feature detection, resolved options and exact part arrays. 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 “minimumFractionDigits and maximumFractionDigits are resolved together, and specifying one can affect the default of the other.” Apply this procedure: Inspect resolvedOptions and test values below, at and above the intended precision. The expected mechanism is: The resolved maximum fraction digits is part of the effective contract and should be inspected rather than guessed. For the compatibility lab, add one near-miss that exposes setting only one digit option and assuming every other default stays unrelated. 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: canteen budget. Transfer the rule using Singapore-dollar amounts and percentages. 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 “minimumFractionDigits and maximumFractionDigits are resolved together, and specifying one can affect the default of the other.” Apply this procedure: Inspect resolvedOptions and test values below, at and above the intended precision. The expected mechanism is: The resolved maximum fraction digits is part of the effective contract and should be inspected rather than guessed. For the canteen budget, add one near-miss that exposes setting only one digit option and assuming every other default stays unrelated. 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 dashboard. Predict the rule using loan counts in several interface locales. 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 “minimumFractionDigits and maximumFractionDigits are resolved together, and specifying one can affect the default of the other.” Apply this procedure: Inspect resolvedOptions and test values below, at and above the intended precision. The expected mechanism is: The resolved maximum fraction digits is part of the effective contract and should be inspected rather than guessed. For the library dashboard, add one near-miss that exposes setting only one digit option and assuming every other default stays unrelated. 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 setting only one digit option and assuming every other default stays unrelated.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Inspect resolvedOptions and test values below, at and above the intended precision.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Fraction-digit defaults interact?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing setting only one digit option and assuming every other default stays unrelated be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision tracker with scores, ratios and percentage progress. Include one ordinary case, one boundary and one deliberate failure caused by setting only one digit option and assuming every other default stays unrelated. 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: minimumFractionDigits and maximumFractionDigits are resolved together, and specifying one can affect the default of the other. It shows a trace, not only a final value. The ordinary case should demonstrate “The resolved maximum fraction digits is part of the effective contract and should be inspected rather than guessed.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Inspect resolvedOptions and test values below, at and above the intended precision. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Fraction-digit defaults interact, separate the documented JavaScript Intl.NumberFormat 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. Significant digits express a different precision rule

Back to contents

Significant-digit options count meaningful digits across the whole number instead of fixed places after the decimal point. 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 mixing significant and fraction constraints without deciding which precision model owns the output. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. State whether the requirement concerns measurement significance or decimal places.

For the Significant digits express a different precision rule chapter on JavaScript Intl.NumberFormat, 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 mixing significant and fraction constraints without deciding which precision model owns the output. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.NumberFormat('en-SG',{maximumSignificantDigits:3}).format(12345)

Explained result. The formatted result is rounded to three significant digits according to the resolved rounding rules. 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: canteen budget. Explain the rule using Singapore-dollar amounts and percentages. 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 “Significant-digit options count meaningful digits across the whole number instead of fixed places after the decimal point.” Apply this procedure: State whether the requirement concerns measurement significance or decimal places. The expected mechanism is: The formatted result is rounded to three significant digits according to the resolved rounding rules. For the canteen budget, add one near-miss that exposes mixing significant and fraction constraints without deciding which precision model owns the output. 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 dashboard. Transfer the rule using loan counts in several interface locales. 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 “Significant-digit options count meaningful digits across the whole number instead of fixed places after the decimal point.” Apply this procedure: State whether the requirement concerns measurement significance or decimal places. The expected mechanism is: The formatted result is rounded to three significant digits according to the resolved rounding rules. For the library dashboard, add one near-miss that exposes mixing significant and fraction constraints without deciding which precision model owns the output. 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 fundraiser. Predict the rule using currency totals, targets and compact summaries. 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 “Significant-digit options count meaningful digits across the whole number instead of fixed places after the decimal point.” Apply this procedure: State whether the requirement concerns measurement significance or decimal places. The expected mechanism is: The formatted result is rounded to three significant digits according to the resolved rounding rules. For the CCA fundraiser, add one near-miss that exposes mixing significant and fraction constraints without deciding which precision model owns the output. 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 display. Contrast the rule using measurements with unit labels and controlled 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 “Significant-digit options count meaningful digits across the whole number instead of fixed places after the decimal point.” Apply this procedure: State whether the requirement concerns measurement significance or decimal places. The expected mechanism is: The formatted result is rounded to three significant digits according to the resolved rounding rules. For the science display, add one near-miss that exposes mixing significant and fraction constraints without deciding which precision model owns the output. 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 mixing significant and fraction constraints without deciding which precision model owns the output.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “State whether the requirement concerns measurement significance or decimal places.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Significant digits express a different precision rule?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing mixing significant and fraction constraints without deciding which precision model owns the output be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family planner with cost ranges and accounting-style negatives. Include one ordinary case, one boundary and one deliberate failure caused by mixing significant and fraction constraints without deciding which precision model owns the output. 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: Significant-digit options count meaningful digits across the whole number instead of fixed places after the decimal point. It shows a trace, not only a final value. The ordinary case should demonstrate “The formatted result is rounded to three significant digits according to the resolved rounding rules.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: State whether the requirement concerns measurement significance or decimal places. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Significant digits express a different precision rule, separate the documented JavaScript Intl.NumberFormat 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. Rounding priority resolves competing digit families

Back to contents

When both significant- and fraction-digit settings are present, roundingPriority helps determine which family governs the result. 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 both constraints are simply applied one after another. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Create boundary values and compare auto, morePrecision and lessPrecision where the runtime supports them.

For the Rounding priority resolves competing digit families chapter on JavaScript Intl.NumberFormat, 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 both constraints are simply applied one after another. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.NumberFormat('en-SG',{maximumFractionDigits:2,maximumSignificantDigits:3,roundingPriority:'auto'})

Explained result. The resolved formatter chooses its rounding type under the specified priority rather than stacking two independent formatting passes. 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 fundraiser. Transfer the rule using currency totals, targets and compact summaries. 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 both significant- and fraction-digit settings are present, roundingPriority helps determine which family governs the result.” Apply this procedure: Create boundary values and compare auto, morePrecision and lessPrecision where the runtime supports them. The expected mechanism is: The resolved formatter chooses its rounding type under the specified priority rather than stacking two independent formatting passes. For the CCA fundraiser, add one near-miss that exposes assuming both constraints are simply applied one after another. 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 display. Predict the rule using measurements with unit labels and controlled 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 both significant- and fraction-digit settings are present, roundingPriority helps determine which family governs the result.” Apply this procedure: Create boundary values and compare auto, morePrecision and lessPrecision where the runtime supports them. The expected mechanism is: The resolved formatter chooses its rounding type under the specified priority rather than stacking two independent formatting passes. For the science display, add one near-miss that exposes assuming both constraints are simply applied one after another. 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 tracker. Contrast the rule using scores, ratios and percentage progress. 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 both significant- and fraction-digit settings are present, roundingPriority helps determine which family governs the result.” Apply this procedure: Create boundary values and compare auto, morePrecision and lessPrecision where the runtime supports them. The expected mechanism is: The resolved formatter chooses its rounding type under the specified priority rather than stacking two independent formatting passes. For the revision tracker, add one near-miss that exposes assuming both constraints are simply applied one after another. 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 planner. Stress-test the rule using cost ranges and accounting-style negatives. 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 both significant- and fraction-digit settings are present, roundingPriority helps determine which family governs the result.” Apply this procedure: Create boundary values and compare auto, morePrecision and lessPrecision where the runtime supports them. The expected mechanism is: The resolved formatter chooses its rounding type under the specified priority rather than stacking two independent formatting passes. For the family planner, add one near-miss that exposes assuming both constraints are simply applied one after another. 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 both constraints are simply applied one after another.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Create boundary values and compare auto, morePrecision and lessPrecision where the runtime supports them.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Rounding priority resolves competing digit families?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming both constraints are simply applied one after another be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny travel exercise with the same number formatted for several requested locales. Include one ordinary case, one boundary and one deliberate failure caused by assuming both constraints are simply applied one after another. 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 both significant- and fraction-digit settings are present, roundingPriority helps determine which family governs the result. It shows a trace, not only a final value. The ordinary case should demonstrate “The resolved formatter chooses its rounding type under the specified priority rather than stacking two independent formatting passes.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Create boundary values and compare auto, morePrecision and lessPrecision where the runtime supports them. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Rounding priority resolves competing digit families, separate the documented JavaScript Intl.NumberFormat 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. Rounding mode and increment are compatibility-sensitive

Back to contents

Current ECMA-402 defines roundingMode and roundingIncrement, but deployed runtimes may differ in support and accepted combinations. 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 publishing an exact cash-rounding claim without testing the target engine. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Feature-test with resolvedOptions and a value that distinguishes the modes.

For the Rounding mode and increment are compatibility-sensitive chapter on JavaScript Intl.NumberFormat, 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 publishing an exact cash-rounding claim without testing the target engine. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const nf=new Intl.NumberFormat('en-SG',{maximumFractionDigits:2,roundingMode:'halfExpand'});

Explained result. Use the option only after the target runtime demonstrates the expected resolved setting and outputs. 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 tracker. Predict the rule using scores, ratios and percentage progress. 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 “Current ECMA-402 defines roundingMode and roundingIncrement, but deployed runtimes may differ in support and accepted combinations.” Apply this procedure: Feature-test with resolvedOptions and a value that distinguishes the modes. The expected mechanism is: Use the option only after the target runtime demonstrates the expected resolved setting and outputs. For the revision tracker, add one near-miss that exposes publishing an exact cash-rounding claim without testing the target engine. 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 planner. Contrast the rule using cost ranges and accounting-style negatives. 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 “Current ECMA-402 defines roundingMode and roundingIncrement, but deployed runtimes may differ in support and accepted combinations.” Apply this procedure: Feature-test with resolvedOptions and a value that distinguishes the modes. The expected mechanism is: Use the option only after the target runtime demonstrates the expected resolved setting and outputs. For the family planner, add one near-miss that exposes publishing an exact cash-rounding claim without testing the target engine. 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: travel exercise. Stress-test the rule using the same number formatted for several requested locales. 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 “Current ECMA-402 defines roundingMode and roundingIncrement, but deployed runtimes may differ in support and accepted combinations.” Apply this procedure: Feature-test with resolvedOptions and a value that distinguishes the modes. The expected mechanism is: Use the option only after the target runtime demonstrates the expected resolved setting and outputs. For the travel exercise, add one near-miss that exposes publishing an exact cash-rounding claim without testing the target engine. 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: compatibility lab. Explain the rule using feature detection, resolved options and exact part arrays. 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 “Current ECMA-402 defines roundingMode and roundingIncrement, but deployed runtimes may differ in support and accepted combinations.” Apply this procedure: Feature-test with resolvedOptions and a value that distinguishes the modes. The expected mechanism is: Use the option only after the target runtime demonstrates the expected resolved setting and outputs. For the compatibility lab, add one near-miss that exposes publishing an exact cash-rounding claim without testing the target engine. 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 publishing an exact cash-rounding claim without testing the target engine.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Feature-test with resolvedOptions and a value that distinguishes the modes.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Rounding mode and increment are compatibility-sensitive?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing publishing an exact cash-rounding claim without testing the target engine be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny compatibility lab with feature detection, resolved options and exact part arrays. Include one ordinary case, one boundary and one deliberate failure caused by publishing an exact cash-rounding claim without testing the target engine. 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: Current ECMA-402 defines roundingMode and roundingIncrement, but deployed runtimes may differ in support and accepted combinations. It shows a trace, not only a final value. The ordinary case should demonstrate “Use the option only after the target runtime demonstrates the expected resolved setting and outputs.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Feature-test with resolvedOptions and a value that distinguishes the modes. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Rounding mode and increment are compatibility-sensitive, separate the documented JavaScript Intl.NumberFormat 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. Notation changes the scale presentation

Back to contents

notation can select standard, scientific, engineering or compact forms while preserving the underlying value. 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 compact text such as 1.2K as a precise serialisation format. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use compact notation for display and retain the original number for computation and storage.

For the Notation changes the scale presentation chapter on JavaScript Intl.NumberFormat, 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 compact text such as 1.2K as a precise serialisation format. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.NumberFormat('en',{notation:'compact',compactDisplay:'short'}).format(1200)

Explained result. The output is a locale-sensitive compact representation, not a reversible data format. 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: travel exercise. Contrast the rule using the same number formatted for several requested locales. 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 “notation can select standard, scientific, engineering or compact forms while preserving the underlying value.” Apply this procedure: Use compact notation for display and retain the original number for computation and storage. The expected mechanism is: The output is a locale-sensitive compact representation, not a reversible data format. For the travel exercise, add one near-miss that exposes treating compact text such as 1.2K as a precise serialisation 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: compatibility lab. Stress-test the rule using feature detection, resolved options and exact part arrays. 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 “notation can select standard, scientific, engineering or compact forms while preserving the underlying value.” Apply this procedure: Use compact notation for display and retain the original number for computation and storage. The expected mechanism is: The output is a locale-sensitive compact representation, not a reversible data format. For the compatibility lab, add one near-miss that exposes treating compact text such as 1.2K as a precise serialisation 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: canteen budget. Explain the rule using Singapore-dollar amounts and percentages. 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 “notation can select standard, scientific, engineering or compact forms while preserving the underlying value.” Apply this procedure: Use compact notation for display and retain the original number for computation and storage. The expected mechanism is: The output is a locale-sensitive compact representation, not a reversible data format. For the canteen budget, add one near-miss that exposes treating compact text such as 1.2K as a precise serialisation 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: library dashboard. Transfer the rule using loan counts in several interface locales. 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 “notation can select standard, scientific, engineering or compact forms while preserving the underlying value.” Apply this procedure: Use compact notation for display and retain the original number for computation and storage. The expected mechanism is: The output is a locale-sensitive compact representation, not a reversible data format. For the library dashboard, add one near-miss that exposes treating compact text such as 1.2K as a precise serialisation 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 compact text such as 1.2K as a precise serialisation format.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Use compact notation for display and retain the original number for computation and storage.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Notation changes the scale presentation?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating compact text such as 1.2K as a precise serialisation format be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny canteen budget with Singapore-dollar amounts and percentages. Include one ordinary case, one boundary and one deliberate failure caused by treating compact text such as 1.2K as a precise serialisation 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: notation can select standard, scientific, engineering or compact forms while preserving the underlying value. It shows a trace, not only a final value. The ordinary case should demonstrate “The output is a locale-sensitive compact representation, not a reversible data format.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use compact notation for display and retain the original number for computation and storage. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Notation changes the scale presentation, separate the documented JavaScript Intl.NumberFormat 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. Sign display and accounting are policy choices

Back to contents

signDisplay controls when signs appear, while currencySign accounting may use a locale-specific accounting pattern for negative currency. 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 locale uses parentheses for accounting negatives. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Test positive, negative, zero and negative zero in each supported locale.

For the Sign display and accounting are policy choices chapter on JavaScript Intl.NumberFormat, 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 locale uses parentheses for accounting negatives. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.NumberFormat('en-SG',{style:'currency',currency:'SGD',currencySign:'accounting'}).format(-25)

Explained result. The result follows the locale’s accounting currency pattern; the application should not hard-code punctuation around it. 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: canteen budget. Stress-test the rule using Singapore-dollar amounts and percentages. 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 “signDisplay controls when signs appear, while currencySign accounting may use a locale-specific accounting pattern for negative currency.” Apply this procedure: Test positive, negative, zero and negative zero in each supported locale. The expected mechanism is: The result follows the locale’s accounting currency pattern; the application should not hard-code punctuation around it. For the canteen budget, add one near-miss that exposes assuming every locale uses parentheses for accounting negatives. 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 dashboard. Explain the rule using loan counts in several interface locales. 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 “signDisplay controls when signs appear, while currencySign accounting may use a locale-specific accounting pattern for negative currency.” Apply this procedure: Test positive, negative, zero and negative zero in each supported locale. The expected mechanism is: The result follows the locale’s accounting currency pattern; the application should not hard-code punctuation around it. For the library dashboard, add one near-miss that exposes assuming every locale uses parentheses for accounting negatives. 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 fundraiser. Transfer the rule using currency totals, targets and compact summaries. 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 “signDisplay controls when signs appear, while currencySign accounting may use a locale-specific accounting pattern for negative currency.” Apply this procedure: Test positive, negative, zero and negative zero in each supported locale. The expected mechanism is: The result follows the locale’s accounting currency pattern; the application should not hard-code punctuation around it. For the CCA fundraiser, add one near-miss that exposes assuming every locale uses parentheses for accounting negatives. 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 display. Predict the rule using measurements with unit labels and controlled 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 “signDisplay controls when signs appear, while currencySign accounting may use a locale-specific accounting pattern for negative currency.” Apply this procedure: Test positive, negative, zero and negative zero in each supported locale. The expected mechanism is: The result follows the locale’s accounting currency pattern; the application should not hard-code punctuation around it. For the science display, add one near-miss that exposes assuming every locale uses parentheses for accounting negatives. 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 locale uses parentheses for accounting negatives.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Test positive, negative, zero and negative zero in each supported locale.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Sign display and accounting are policy choices?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming every locale uses parentheses for accounting negatives be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library dashboard with loan counts in several interface locales. Include one ordinary case, one boundary and one deliberate failure caused by assuming every locale uses parentheses for accounting negatives. 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: signDisplay controls when signs appear, while currencySign accounting may use a locale-specific accounting pattern for negative currency. It shows a trace, not only a final value. The ordinary case should demonstrate “The result follows the locale’s accounting currency pattern; the application should not hard-code punctuation around it.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Test positive, negative, zero and negative zero in each supported locale. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Sign display and accounting are policy choices, separate the documented JavaScript Intl.NumberFormat 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. Grouping belongs to locale data and options

Back to contents

useGrouping controls grouping behaviour, but separator characters and group sizes come from the resolved 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 splitting a formatted number on comma to recover digits. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use formatToParts for presentation logic and keep raw numbers for data logic.

For the Grouping belongs to locale data and options chapter on JavaScript Intl.NumberFormat, 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 a formatted number on comma to recover digits. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.NumberFormat('en-SG',{useGrouping:'always'}).format(1234567)

Explained result. Grouping is requested, but its visible characters remain locale-sensitive. 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 fundraiser. Explain the rule using currency totals, targets and compact summaries. 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 “useGrouping controls grouping behaviour, but separator characters and group sizes come from the resolved locale.” Apply this procedure: Use formatToParts for presentation logic and keep raw numbers for data logic. The expected mechanism is: Grouping is requested, but its visible characters remain locale-sensitive. For the CCA fundraiser, add one near-miss that exposes splitting a formatted number on comma to recover digits. 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 display. Transfer the rule using measurements with unit labels and controlled 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 “useGrouping controls grouping behaviour, but separator characters and group sizes come from the resolved locale.” Apply this procedure: Use formatToParts for presentation logic and keep raw numbers for data logic. The expected mechanism is: Grouping is requested, but its visible characters remain locale-sensitive. For the science display, add one near-miss that exposes splitting a formatted number on comma to recover digits. 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 tracker. Predict the rule using scores, ratios and percentage progress. 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 “useGrouping controls grouping behaviour, but separator characters and group sizes come from the resolved locale.” Apply this procedure: Use formatToParts for presentation logic and keep raw numbers for data logic. The expected mechanism is: Grouping is requested, but its visible characters remain locale-sensitive. For the revision tracker, add one near-miss that exposes splitting a formatted number on comma to recover digits. 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 planner. Contrast the rule using cost ranges and accounting-style negatives. 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 “useGrouping controls grouping behaviour, but separator characters and group sizes come from the resolved locale.” Apply this procedure: Use formatToParts for presentation logic and keep raw numbers for data logic. The expected mechanism is: Grouping is requested, but its visible characters remain locale-sensitive. For the family planner, add one near-miss that exposes splitting a formatted number on comma to recover digits. 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 a formatted number on comma to recover digits.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Use formatToParts for presentation logic and keep raw numbers for data logic.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Grouping belongs to locale data and options?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing splitting a formatted number on comma to recover digits be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA fundraiser with currency totals, targets and compact summaries. Include one ordinary case, one boundary and one deliberate failure caused by splitting a formatted number on comma to recover digits. 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: useGrouping controls grouping behaviour, but separator characters and group sizes come from the resolved locale. It shows a trace, not only a final value. The ordinary case should demonstrate “Grouping is requested, but its visible characters remain locale-sensitive.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use formatToParts for presentation logic and keep raw numbers for data logic. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Grouping belongs to locale data and options, separate the documented JavaScript Intl.NumberFormat 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. The format accessor returns a bound function

Back to contents

The format getter caches and returns a function bound to its NumberFormat instance, so it can be passed to map. 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 calling the accessor with a different this value to change its locale. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Construct a new formatter for a new policy instead of rebinding the function.

For the The format accessor returns a bound function chapter on JavaScript Intl.NumberFormat, 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 calling the accessor with a different this value to change its locale. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const format=new Intl.NumberFormat('en-SG').format;
[1,2,3].map(format)

Explained result. Each element is formatted with the original formatter’s resolved locale and options. 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 tracker. Transfer the rule using scores, ratios and percentage progress. 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 format getter caches and returns a function bound to its NumberFormat instance, so it can be passed to map.” Apply this procedure: Construct a new formatter for a new policy instead of rebinding the function. The expected mechanism is: Each element is formatted with the original formatter’s resolved locale and options. For the revision tracker, add one near-miss that exposes calling the accessor with a different this value to change its locale. 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 planner. Predict the rule using cost ranges and accounting-style negatives. 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 format getter caches and returns a function bound to its NumberFormat instance, so it can be passed to map.” Apply this procedure: Construct a new formatter for a new policy instead of rebinding the function. The expected mechanism is: Each element is formatted with the original formatter’s resolved locale and options. For the family planner, add one near-miss that exposes calling the accessor with a different this value to change its locale. 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: travel exercise. Contrast the rule using the same number formatted for several requested locales. 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 format getter caches and returns a function bound to its NumberFormat instance, so it can be passed to map.” Apply this procedure: Construct a new formatter for a new policy instead of rebinding the function. The expected mechanism is: Each element is formatted with the original formatter’s resolved locale and options. For the travel exercise, add one near-miss that exposes calling the accessor with a different this value to change its locale. 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: compatibility lab. Stress-test the rule using feature detection, resolved options and exact part arrays. 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 format getter caches and returns a function bound to its NumberFormat instance, so it can be passed to map.” Apply this procedure: Construct a new formatter for a new policy instead of rebinding the function. The expected mechanism is: Each element is formatted with the original formatter’s resolved locale and options. For the compatibility lab, add one near-miss that exposes calling the accessor with a different this value to change its locale. 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 calling the accessor with a different this value to change its locale.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Construct a new formatter for a new policy instead of rebinding the function.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from The format accessor returns a bound function?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing calling the accessor with a different this value to change its locale be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science display with measurements with unit labels and controlled precision. Include one ordinary case, one boundary and one deliberate failure caused by calling the accessor with a different this value to change its locale. 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 format getter caches and returns a function bound to its NumberFormat instance, so it can be passed to map. It shows a trace, not only a final value. The ordinary case should demonstrate “Each element is formatted with the original formatter’s resolved locale and options.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Construct a new formatter for a new policy instead of rebinding the function. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For The format accessor returns a bound function, separate the documented JavaScript Intl.NumberFormat 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 semantic pieces

Back to contents

formatToParts returns ordered records such as integer, group, decimal, fraction, currency or unit so interfaces can style parts without parsing punctuation. 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 that assumes one separator and symbol position. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Inspect part types and preserve their returned order.

For the formatToParts exposes semantic pieces chapter on JavaScript Intl.NumberFormat, 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 that assumes one separator and symbol position. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

new Intl.NumberFormat('en-SG',{style:'currency',currency:'SGD'}).formatToParts(1234.5)

Explained result. The array identifies semantic parts while locale data controls their values and order. 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: travel exercise. Predict the rule using the same number formatted for several requested locales. 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 ordered records such as integer, group, decimal, fraction, currency or unit so interfaces can style parts without parsing punctuation.” Apply this procedure: Inspect part types and preserve their returned order. The expected mechanism is: The array identifies semantic parts while locale data controls their values and order. For the travel exercise, add one near-miss that exposes using a regular expression that assumes one separator and symbol position. 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: compatibility lab. Contrast the rule using feature detection, resolved options and exact part arrays. 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 ordered records such as integer, group, decimal, fraction, currency or unit so interfaces can style parts without parsing punctuation.” Apply this procedure: Inspect part types and preserve their returned order. The expected mechanism is: The array identifies semantic parts while locale data controls their values and order. For the compatibility lab, add one near-miss that exposes using a regular expression that assumes one separator and symbol position. 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: canteen budget. Stress-test the rule using Singapore-dollar amounts and percentages. 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 ordered records such as integer, group, decimal, fraction, currency or unit so interfaces can style parts without parsing punctuation.” Apply this procedure: Inspect part types and preserve their returned order. The expected mechanism is: The array identifies semantic parts while locale data controls their values and order. For the canteen budget, add one near-miss that exposes using a regular expression that assumes one separator and symbol position. 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 dashboard. Explain the rule using loan counts in several interface locales. 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 ordered records such as integer, group, decimal, fraction, currency or unit so interfaces can style parts without parsing punctuation.” Apply this procedure: Inspect part types and preserve their returned order. The expected mechanism is: The array identifies semantic parts while locale data controls their values and order. For the library dashboard, add one near-miss that exposes using a regular expression that assumes one separator and symbol position. 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 that assumes one separator and symbol position.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Inspect part types and preserve their returned 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from formatToParts exposes semantic pieces?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using a regular expression that assumes one separator and symbol position be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision tracker with scores, ratios and percentage progress. Include one ordinary case, one boundary and one deliberate failure caused by using a regular expression that assumes one separator and symbol position. 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 ordered records such as integer, group, decimal, fraction, currency or unit so interfaces can style parts without parsing punctuation. It shows a trace, not only a final value. The ordinary case should demonstrate “The array identifies semantic parts while locale data controls their values and order.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Inspect part types and preserve their returned order. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For formatToParts exposes semantic pieces, separate the documented JavaScript Intl.NumberFormat 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. Number ranges need runtime verification

Back to contents

formatRange and formatRangeToParts format two endpoints with locale-aware collapsing, but availability must be checked in the target environment. 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 joining two independently formatted strings with a hard-coded hyphen and claiming equivalent locale behaviour. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Feature-detect the methods, test equal and unequal endpoints and provide a clear fallback.

For the Number ranges need runtime verification chapter on JavaScript Intl.NumberFormat, 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 joining two independently formatted strings with a hard-coded hyphen and claiming equivalent locale behaviour. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const nf=new Intl.NumberFormat('en-SG');
if(typeof nf.formatRange==='function') nf.formatRange(10,20);

Explained result. A supporting runtime can produce a locale-aware range; other runtimes need an explicitly tested fallback. 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: canteen budget. Contrast the rule using Singapore-dollar amounts and percentages. 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 “formatRange and formatRangeToParts format two endpoints with locale-aware collapsing, but availability must be checked in the target environment.” Apply this procedure: Feature-detect the methods, test equal and unequal endpoints and provide a clear fallback. The expected mechanism is: A supporting runtime can produce a locale-aware range; other runtimes need an explicitly tested fallback. For the canteen budget, add one near-miss that exposes joining two independently formatted strings with a hard-coded hyphen and claiming equivalent locale behaviour. 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 dashboard. Stress-test the rule using loan counts in several interface locales. 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 “formatRange and formatRangeToParts format two endpoints with locale-aware collapsing, but availability must be checked in the target environment.” Apply this procedure: Feature-detect the methods, test equal and unequal endpoints and provide a clear fallback. The expected mechanism is: A supporting runtime can produce a locale-aware range; other runtimes need an explicitly tested fallback. For the library dashboard, add one near-miss that exposes joining two independently formatted strings with a hard-coded hyphen and claiming equivalent locale behaviour. 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 fundraiser. Explain the rule using currency totals, targets and compact summaries. 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 “formatRange and formatRangeToParts format two endpoints with locale-aware collapsing, but availability must be checked in the target environment.” Apply this procedure: Feature-detect the methods, test equal and unequal endpoints and provide a clear fallback. The expected mechanism is: A supporting runtime can produce a locale-aware range; other runtimes need an explicitly tested fallback. For the CCA fundraiser, add one near-miss that exposes joining two independently formatted strings with a hard-coded hyphen and claiming equivalent locale behaviour. 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 display. Transfer the rule using measurements with unit labels and controlled 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 “formatRange and formatRangeToParts format two endpoints with locale-aware collapsing, but availability must be checked in the target environment.” Apply this procedure: Feature-detect the methods, test equal and unequal endpoints and provide a clear fallback. The expected mechanism is: A supporting runtime can produce a locale-aware range; other runtimes need an explicitly tested fallback. For the science display, add one near-miss that exposes joining two independently formatted strings with a hard-coded hyphen and claiming equivalent locale behaviour. 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 joining two independently formatted strings with a hard-coded hyphen and claiming equivalent locale behaviour.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Feature-detect the methods, test equal and unequal endpoints and provide a clear fallback.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Number ranges need runtime verification?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing joining two independently formatted strings with a hard-coded hyphen and claiming equivalent locale behaviour be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family planner with cost ranges and accounting-style negatives. Include one ordinary case, one boundary and one deliberate failure caused by joining two independently formatted strings with a hard-coded hyphen and claiming equivalent locale behaviour. 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: formatRange and formatRangeToParts format two endpoints with locale-aware collapsing, but availability must be checked in the target environment. It shows a trace, not only a final value. The ordinary case should demonstrate “A supporting runtime can produce a locale-aware range; other runtimes need an explicitly tested fallback.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Feature-detect the methods, test equal and unequal endpoints and provide a clear fallback. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Number ranges need runtime verification, separate the documented JavaScript Intl.NumberFormat 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. resolvedOptions reveals the effective contract

Back to contents

resolvedOptions reports the locale, numbering system and relevant options computed during initialisation. 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 debugging only the output string when defaults are interacting. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Log requested options beside resolvedOptions and a small value matrix.

For the resolvedOptions reveals the effective contract chapter on JavaScript Intl.NumberFormat, 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 debugging only the output string when defaults are interacting. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const nf=new Intl.NumberFormat('en-SG',{style:'percent'});
nf.resolvedOptions()

Explained result. The object exposes the formatter’s effective settings, including defaults not written in source. 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 fundraiser. Stress-test the rule using currency totals, targets and compact summaries. 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 locale, numbering system and relevant options computed during initialisation.” Apply this procedure: Log requested options beside resolvedOptions and a small value matrix. The expected mechanism is: The object exposes the formatter’s effective settings, including defaults not written in source. For the CCA fundraiser, add one near-miss that exposes debugging only the output string when defaults are interacting. 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 display. Explain the rule using measurements with unit labels and controlled 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 “resolvedOptions reports the locale, numbering system and relevant options computed during initialisation.” Apply this procedure: Log requested options beside resolvedOptions and a small value matrix. The expected mechanism is: The object exposes the formatter’s effective settings, including defaults not written in source. For the science display, add one near-miss that exposes debugging only the output string when defaults are interacting. 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 tracker. Transfer the rule using scores, ratios and percentage progress. 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 locale, numbering system and relevant options computed during initialisation.” Apply this procedure: Log requested options beside resolvedOptions and a small value matrix. The expected mechanism is: The object exposes the formatter’s effective settings, including defaults not written in source. For the revision tracker, add one near-miss that exposes debugging only the output string when defaults are interacting. 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 planner. Predict the rule using cost ranges and accounting-style negatives. 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 locale, numbering system and relevant options computed during initialisation.” Apply this procedure: Log requested options beside resolvedOptions and a small value matrix. The expected mechanism is: The object exposes the formatter’s effective settings, including defaults not written in source. For the family planner, add one near-miss that exposes debugging only the output string when defaults are interacting. 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 debugging only the output string when defaults are interacting.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Log requested options beside resolvedOptions and a small value matrix.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from resolvedOptions reveals the effective contract?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing debugging only the output string when defaults are interacting be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny travel exercise with the same number formatted for several requested locales. Include one ordinary case, one boundary and one deliberate failure caused by debugging only the output string when defaults are interacting. 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 locale, numbering system and relevant options computed during initialisation. It shows a trace, not only a final value. The ordinary case should demonstrate “The object exposes the formatter’s effective settings, including defaults not written in source.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Log requested options beside resolvedOptions and a small value matrix. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For resolvedOptions reveals the effective contract, separate the documented JavaScript Intl.NumberFormat 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. Special numeric values deserve explicit decisions

Back to contents

NaN, Infinity and negative zero receive locale-sensitive representations and may need domain validation before display. 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 allowing an invalid calculation to appear as polished output. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Validate domain constraints before formatting and separately test Object.is(value,-0).

For the Special numeric values deserve explicit decisions chapter on JavaScript Intl.NumberFormat, 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 allowing an invalid calculation to appear as polished output. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const nf=new Intl.NumberFormat('en-SG',{signDisplay:'auto'});
[nf.format(NaN),nf.format(Infinity),nf.format(-0)]

Explained result. The formatter represents all three values; the application must decide whether each is meaningful or an error. 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 tracker. Explain the rule using scores, ratios and percentage progress. 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 “NaN, Infinity and negative zero receive locale-sensitive representations and may need domain validation before display.” Apply this procedure: Validate domain constraints before formatting and separately test Object.is(value,-0). The expected mechanism is: The formatter represents all three values; the application must decide whether each is meaningful or an error. For the revision tracker, add one near-miss that exposes allowing an invalid calculation to appear as polished output. 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 planner. Transfer the rule using cost ranges and accounting-style negatives. 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 “NaN, Infinity and negative zero receive locale-sensitive representations and may need domain validation before display.” Apply this procedure: Validate domain constraints before formatting and separately test Object.is(value,-0). The expected mechanism is: The formatter represents all three values; the application must decide whether each is meaningful or an error. For the family planner, add one near-miss that exposes allowing an invalid calculation to appear as polished output. 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: travel exercise. Predict the rule using the same number formatted for several requested locales. 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 “NaN, Infinity and negative zero receive locale-sensitive representations and may need domain validation before display.” Apply this procedure: Validate domain constraints before formatting and separately test Object.is(value,-0). The expected mechanism is: The formatter represents all three values; the application must decide whether each is meaningful or an error. For the travel exercise, add one near-miss that exposes allowing an invalid calculation to appear as polished output. 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: compatibility lab. Contrast the rule using feature detection, resolved options and exact part arrays. 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 “NaN, Infinity and negative zero receive locale-sensitive representations and may need domain validation before display.” Apply this procedure: Validate domain constraints before formatting and separately test Object.is(value,-0). The expected mechanism is: The formatter represents all three values; the application must decide whether each is meaningful or an error. For the compatibility lab, add one near-miss that exposes allowing an invalid calculation to appear as polished output. 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 allowing an invalid calculation to appear as polished output.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Validate domain constraints before formatting and separately test Object.is(value,-0).” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Special numeric values deserve explicit decisions?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing allowing an invalid calculation to appear as polished output be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny compatibility lab with feature detection, resolved options and exact part arrays. Include one ordinary case, one boundary and one deliberate failure caused by allowing an invalid calculation to appear as polished output. 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: NaN, Infinity and negative zero receive locale-sensitive representations and may need domain validation before display. It shows a trace, not only a final value. The ordinary case should demonstrate “The formatter represents all three values; the application must decide whether each is meaningful or an error.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Validate domain constraints before formatting and separately test Object.is(value,-0). Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Special numeric values deserve explicit decisions, separate the documented JavaScript Intl.NumberFormat 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. Formatted text is not a general parser input

Back to contents

Intl.NumberFormat has no inverse parse method, and locale punctuation, spaces, signs and labels make ad-hoc reversal unsafe. 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 removing commas and calling Number on every formatted string. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Accept structured numeric input, validate it and use formatting only at the display boundary.

For the Formatted text is not a general parser input chapter on JavaScript Intl.NumberFormat, 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 removing commas and calling Number on every formatted string. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const raw=1250.5; const shown=new Intl.NumberFormat('fr-FR').format(raw);

Explained result. shown is for readers; raw remains the value used for calculation, transport and storage. 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: travel exercise. Transfer the rule using the same number formatted for several requested locales. 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.NumberFormat has no inverse parse method, and locale punctuation, spaces, signs and labels make ad-hoc reversal unsafe.” Apply this procedure: Accept structured numeric input, validate it and use formatting only at the display boundary. The expected mechanism is: shown is for readers; raw remains the value used for calculation, transport and storage. For the travel exercise, add one near-miss that exposes removing commas and calling Number on every formatted 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: compatibility lab. Predict the rule using feature detection, resolved options and exact part arrays. 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.NumberFormat has no inverse parse method, and locale punctuation, spaces, signs and labels make ad-hoc reversal unsafe.” Apply this procedure: Accept structured numeric input, validate it and use formatting only at the display boundary. The expected mechanism is: shown is for readers; raw remains the value used for calculation, transport and storage. For the compatibility lab, add one near-miss that exposes removing commas and calling Number on every formatted 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: canteen budget. Contrast the rule using Singapore-dollar amounts and percentages. 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.NumberFormat has no inverse parse method, and locale punctuation, spaces, signs and labels make ad-hoc reversal unsafe.” Apply this procedure: Accept structured numeric input, validate it and use formatting only at the display boundary. The expected mechanism is: shown is for readers; raw remains the value used for calculation, transport and storage. For the canteen budget, add one near-miss that exposes removing commas and calling Number on every formatted 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 dashboard. Stress-test the rule using loan counts in several interface locales. 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.NumberFormat has no inverse parse method, and locale punctuation, spaces, signs and labels make ad-hoc reversal unsafe.” Apply this procedure: Accept structured numeric input, validate it and use formatting only at the display boundary. The expected mechanism is: shown is for readers; raw remains the value used for calculation, transport and storage. For the library dashboard, add one near-miss that exposes removing commas and calling Number on every formatted 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 removing commas and calling Number on every formatted string.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Accept structured numeric input, validate it and use formatting only at the display boundary.” 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.NumberFormat syntax. For this chapter, useful prompts are: “What did you expect from Formatted text is not a general parser input?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing removing commas and calling Number on every formatted string be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny canteen budget with Singapore-dollar amounts and percentages. Include one ordinary case, one boundary and one deliberate failure caused by removing commas and calling Number on every formatted 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: Intl.NumberFormat has no inverse parse method, and locale punctuation, spaces, signs and labels make ad-hoc reversal unsafe. It shows a trace, not only a final value. The ordinary case should demonstrate “shown is for readers; raw remains the value used for calculation, transport and storage.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Accept structured numeric input, validate it and use formatting only at the display boundary. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Formatted text is not a general parser input, separate the documented JavaScript Intl.NumberFormat 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. canteen budget: model, boundary and recovery

Create a small canteen budget using Singapore-dollar amounts and percentages. Combine “Formatting is presentation, not arithmetic” 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.NumberFormat formats an existing mathematical value; it does not convert currencies or change the underlying number. Apply: Separate value calculation, currency identity and final display into three steps. Verify: The result is a Singapore-dollar display of 12.5, not a converted amount. 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 dashboard: model, boundary and recovery

Create a small library dashboard using loan counts in several interface locales. Combine “Percent style scales for display” 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: Percent formatting represents the numeric input as a percentage, so 0.25 displays as twenty-five percent in ordinary settings. Apply: Write whether the domain stores a ratio or percentage points before formatting. Verify: The display is 25% under ordinary en-SG locale data. 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 fundraiser: model, boundary and recovery

Create a small CCA fundraiser using currency totals, targets and compact summaries. Combine “Unit style names a measurement” 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: Unit formatting requires a sanctioned unit identifier and can use long, short or narrow display forms. Apply: Convert the numeric value separately, then format it with the correct unit. Verify: The output labels twelve kilometres per hour; no measurement conversion occurs. 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 display: model, boundary and recovery

Create a small science display using measurements with unit labels and controlled precision. Combine “Rounding priority resolves competing digit families” 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: When both significant- and fraction-digit settings are present, roundingPriority helps determine which family governs the result. Apply: Create boundary values and compare auto, morePrecision and lessPrecision where the runtime supports them. Verify: The resolved formatter chooses its rounding type under the specified priority rather than stacking two independent formatting passes. 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 tracker: model, boundary and recovery

Create a small revision tracker using scores, ratios and percentage progress. Combine “Sign display and accounting are policy choices” 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: signDisplay controls when signs appear, while currencySign accounting may use a locale-specific accounting pattern for negative currency. Apply: Test positive, negative, zero and negative zero in each supported locale. Verify: The result follows the locale’s accounting currency pattern; the application should not hard-code punctuation around it. 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 planner: model, boundary and recovery

Create a small family planner using cost ranges and accounting-style negatives. Combine “formatToParts exposes semantic 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 ordered records such as integer, group, decimal, fraction, currency or unit so interfaces can style parts without parsing punctuation. Apply: Inspect part types and preserve their returned order. Verify: The array identifies semantic parts while locale data controls their values and order. 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. travel exercise: model, boundary and recovery

Create a small travel exercise using the same number formatted for several requested locales. Combine “Special numeric values deserve explicit decisions” 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: NaN, Infinity and negative zero receive locale-sensitive representations and may need domain validation before display. Apply: Validate domain constraints before formatting and separately test Object.is(value,-0). Verify: The formatter represents all three values; the application must decide whether each is meaningful or an error. 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. compatibility lab: model, boundary and recovery

Create a small compatibility lab using feature detection, resolved options and exact part arrays. Combine “Locale negotiation chooses an available locale” 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 runtime canonicalises requested locales and resolves a supported locale using the selected locale-matching policy. Apply: Call supportedLocalesOf and inspect resolvedOptions().locale in the target runtime. Verify: The resolved locale is implementation data selected from the requested list and available locale set. 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 的更多信息

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

继续阅读