Small Group Tutorials

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

How to Master JavaScript Intl.getCanonicalLocales() in Punggol Tuition

Student in a navy skirt and tie holds a notebook and raises a fist in a bright corridor.

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

JavaScript Intl.getCanonicalLocales() validates requested Unicode locale identifiers, converts each one to its canonical form, removes canonical duplicates and returns a new array in first-seen order. It does not negotiate with an application’s supported locales, infer a best match, translate text or maximize a tag. Mastery means keeping canonicalization separate from availability, selection and presentation. 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. Canonicalization has one focused job

Back to contents

The function turns a locale input into a validated, canonical, duplicate-free array of locale identifiers. 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 the result as proof that a locale is supported by a formatter or by the application. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Write separate pipeline stages for canonicalization, support testing, matching and display.

For the Canonicalization has one focused job chapter on JavaScript Intl.getCanonicalLocales(), 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 the result as proof that a locale is supported by a formatter or by the application. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

console.log(Intl.getCanonicalLocales(['EN-us','fr-fr']))

Explained result. The result is [“en-US”, “fr-FR”] with canonical casing and preserved 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: family language picker. Predict the rule using submitted locale tags, duplicate choices and a stored preference. 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 function turns a locale input into a validated, canonical, duplicate-free array of locale identifiers.” Apply this procedure: Write separate pipeline stages for canonicalization, support testing, matching and display. The expected mechanism is: The result is [“en-US”, “fr-FR”] with canonical casing and preserved order. For the family language picker, add one near-miss that exposes treating the result as proof that a locale is supported by a formatter or by the application. 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: school event page. Contrast the rule using English, Malay, Chinese and Tamil interface requests. 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 function turns a locale input into a validated, canonical, duplicate-free array of locale identifiers.” Apply this procedure: Write separate pipeline stages for canonicalization, support testing, matching and display. The expected mechanism is: The result is [“en-US”, “fr-FR”] with canonical casing and preserved order. For the school event page, add one near-miss that exposes treating the result as proof that a locale is supported by a formatter or by the application. 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: library catalogue. Stress-test the rule using display locale, search locale and saved filter state. 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 function turns a locale input into a validated, canonical, duplicate-free array of locale identifiers.” Apply this procedure: Write separate pipeline stages for canonicalization, support testing, matching and display. The expected mechanism is: The result is [“en-US”, “fr-FR”] with canonical casing and preserved order. For the library catalogue, add one near-miss that exposes treating the result as proof that a locale is supported by a formatter or by the application. 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: CCA registration. Explain the rule using browser preference, supported locales and fallback policy. 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 function turns a locale input into a validated, canonical, duplicate-free array of locale identifiers.” Apply this procedure: Write separate pipeline stages for canonicalization, support testing, matching and display. The expected mechanism is: The result is [“en-US”, “fr-FR”] with canonical casing and preserved order. For the CCA registration, add one near-miss that exposes treating the result as proof that a locale is supported by a formatter or by the application. 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 the result as proof that a locale is supported by a formatter or by the application.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Write separate pipeline stages for canonicalization, support testing, matching and display.” and record the first changed observation.
  • Transfer check: repeat the rule in a second context and identify what remains invariant.

A parent does not need to know the final JavaScript Intl.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Canonicalization has one focused job?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating the result as proof that a locale is supported by a formatter or by the application be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny travel worksheet with region tags, script tags and translated labels. Include one ordinary case, one boundary and one deliberate failure caused by treating the result as proof that a locale is supported by a formatter or by the application. 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 function turns a locale input into a validated, canonical, duplicate-free array of locale identifiers. It shows a trace, not only a final value. The ordinary case should demonstrate “The result is [“en-US”, “fr-FR”] with canonical casing and preserved order.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Write separate pipeline stages for canonicalization, support testing, matching and display. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Canonicalization has one focused job, separate the documented JavaScript Intl.getCanonicalLocales() 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. Undefined means an empty request list

Back to contents

When the locales argument is undefined or omitted, the canonicalized locale list is empty. 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 expecting the runtime default locale to appear automatically. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Compare omission with constructing an Intl formatter that performs its own default-locale selection.

For the Undefined means an empty request list chapter on JavaScript Intl.getCanonicalLocales(), 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 expecting the runtime default locale to appear automatically. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

console.log(Intl.getCanonicalLocales())

Explained result. The function returns an empty array; it does not insert the runtime default. 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: library catalogue. Contrast the rule using display locale, search locale and saved filter state. 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 the locales argument is undefined or omitted, the canonicalized locale list is empty.” Apply this procedure: Compare omission with constructing an Intl formatter that performs its own default-locale selection. The expected mechanism is: The function returns an empty array; it does not insert the runtime default. For the library catalogue, add one near-miss that exposes expecting the runtime default locale to appear automatically. 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: CCA registration. Stress-test the rule using browser preference, supported locales and fallback policy. 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 the locales argument is undefined or omitted, the canonicalized locale list is empty.” Apply this procedure: Compare omission with constructing an Intl formatter that performs its own default-locale selection. The expected mechanism is: The function returns an empty array; it does not insert the runtime default. For the CCA registration, add one near-miss that exposes expecting the runtime default locale to appear automatically. 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: science dashboard. Explain the rule using number-format locale, unit display and canonical cache key. 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 the locales argument is undefined or omitted, the canonicalized locale list is empty.” Apply this procedure: Compare omission with constructing an Intl formatter that performs its own default-locale selection. The expected mechanism is: The function returns an empty array; it does not insert the runtime default. For the science dashboard, add one near-miss that exposes expecting the runtime default locale to appear automatically. 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: travel worksheet. Transfer the rule using region tags, script tags and translated labels. 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 the locales argument is undefined or omitted, the canonicalized locale list is empty.” Apply this procedure: Compare omission with constructing an Intl formatter that performs its own default-locale selection. The expected mechanism is: The function returns an empty array; it does not insert the runtime default. For the travel worksheet, add one near-miss that exposes expecting the runtime default locale to appear automatically. 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 expecting the runtime default locale to appear automatically.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Compare omission with constructing an Intl formatter that performs its own default-locale selection.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Undefined means an empty request list?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing expecting the runtime default locale to appear automatically be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision app with user locale, content locale and formatter construction. Include one ordinary case, one boundary and one deliberate failure caused by expecting the runtime default locale to appear automatically. 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 the locales argument is undefined or omitted, the canonicalized locale list is empty. It shows a trace, not only a final value. The ordinary case should demonstrate “The function returns an empty array; it does not insert the runtime default.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Compare omission with constructing an Intl formatter that performs its own default-locale selection. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Undefined means an empty request list, separate the documented JavaScript Intl.getCanonicalLocales() 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. A single string becomes one list entry

Back to contents

A string argument is treated as one locale identifier rather than as an array-like sequence of characters. 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 predicting that the characters e, n, hyphen and U will be processed separately. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Test one mixed-case string and inspect the one-element output array.

For the A single string becomes one list entry chapter on JavaScript Intl.getCanonicalLocales(), 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 predicting that the characters e, n, hyphen and U will be processed separately. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

console.log(Intl.getCanonicalLocales('EN-us'))

Explained result. The result is the one-element array [“en-US”]. 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: science dashboard. Stress-test the rule using number-format locale, unit display and canonical cache key. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A string argument is treated as one locale identifier rather than as an array-like sequence of characters.” Apply this procedure: Test one mixed-case string and inspect the one-element output array. The expected mechanism is: The result is the one-element array [“en-US”]. For the science dashboard, add one near-miss that exposes predicting that the characters e, n, hyphen and U will be processed separately. 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: travel worksheet. Explain the rule using region tags, script tags and translated labels. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A string argument is treated as one locale identifier rather than as an array-like sequence of characters.” Apply this procedure: Test one mixed-case string and inspect the one-element output array. The expected mechanism is: The result is the one-element array [“en-US”]. For the travel worksheet, add one near-miss that exposes predicting that the characters e, n, hyphen and U will be processed separately. 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 app. Transfer the rule using user locale, content locale and formatter construction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A string argument is treated as one locale identifier rather than as an array-like sequence of characters.” Apply this procedure: Test one mixed-case string and inspect the one-element output array. The expected mechanism is: The result is the one-element array [“en-US”]. For the revision app, add one near-miss that exposes predicting that the characters e, n, hyphen and U will be processed separately. 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: test matrix. Predict the rule using valid tags, invalid tags, aliases and duplicate canonical forms. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A string argument is treated as one locale identifier rather than as an array-like sequence of characters.” Apply this procedure: Test one mixed-case string and inspect the one-element output array. The expected mechanism is: The result is the one-element array [“en-US”]. For the test matrix, add one near-miss that exposes predicting that the characters e, n, hyphen and U will be processed separately. 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 predicting that the characters e, n, hyphen and U will be processed separately.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Test one mixed-case string and inspect the one-element output array.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from A single string becomes one list entry?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing predicting that the characters e, n, hyphen and U will be processed separately be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test matrix with valid tags, invalid tags, aliases and duplicate canonical forms. Include one ordinary case, one boundary and one deliberate failure caused by predicting that the characters e, n, hyphen and U will be processed separately. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: A string argument is treated as one locale identifier rather than as an array-like sequence of characters. It shows a trace, not only a final value. The ordinary case should demonstrate “The result is the one-element array [“en-US”].” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Test one mixed-case string and inspect the one-element output array. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For A single string becomes one list entry, separate the documented JavaScript Intl.getCanonicalLocales() 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. Ordinary arrays are processed by index

Back to contents

An array supplies locale entries in indexed order, and the output follows the first occurrence of each canonical 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 sorting the result or assuming set-style insertion details do not matter. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use a three-entry array with one duplicate and record each canonical step.

For the Ordinary arrays are processed by index chapter on JavaScript Intl.getCanonicalLocales(), 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 sorting the result or assuming set-style insertion details do not matter. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

console.log(Intl.getCanonicalLocales(['fr-fr','EN-us','fr-FR']))

Explained result. The result is [“fr-FR”, “en-US”]; the later canonical duplicate is omitted. 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 app. Explain the rule using user locale, content locale and formatter construction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An array supplies locale entries in indexed order, and the output follows the first occurrence of each canonical value.” Apply this procedure: Use a three-entry array with one duplicate and record each canonical step. The expected mechanism is: The result is [“fr-FR”, “en-US”]; the later canonical duplicate is omitted. For the revision app, add one near-miss that exposes sorting the result or assuming set-style insertion details do not matter. 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: test matrix. Transfer the rule using valid tags, invalid tags, aliases and duplicate canonical forms. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An array supplies locale entries in indexed order, and the output follows the first occurrence of each canonical value.” Apply this procedure: Use a three-entry array with one duplicate and record each canonical step. The expected mechanism is: The result is [“fr-FR”, “en-US”]; the later canonical duplicate is omitted. For the test matrix, add one near-miss that exposes sorting the result or assuming set-style insertion details do not matter. 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: family language picker. Predict the rule using submitted locale tags, duplicate choices and a stored preference. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An array supplies locale entries in indexed order, and the output follows the first occurrence of each canonical value.” Apply this procedure: Use a three-entry array with one duplicate and record each canonical step. The expected mechanism is: The result is [“fr-FR”, “en-US”]; the later canonical duplicate is omitted. For the family language picker, add one near-miss that exposes sorting the result or assuming set-style insertion details do not matter. 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: school event page. Contrast the rule using English, Malay, Chinese and Tamil interface requests. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An array supplies locale entries in indexed order, and the output follows the first occurrence of each canonical value.” Apply this procedure: Use a three-entry array with one duplicate and record each canonical step. The expected mechanism is: The result is [“fr-FR”, “en-US”]; the later canonical duplicate is omitted. For the school event page, add one near-miss that exposes sorting the result or assuming set-style insertion details do not matter. 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 sorting the result or assuming set-style insertion details do not matter.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Use a three-entry array with one duplicate and record each canonical step.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Ordinary arrays are processed by index?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing sorting the result or assuming set-style insertion details do not matter be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family language picker with submitted locale tags, duplicate choices and a stored preference. Include one ordinary case, one boundary and one deliberate failure caused by sorting the result or assuming set-style insertion details do not matter. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: An array supplies locale entries in indexed order, and the output follows the first occurrence of each canonical value. It shows a trace, not only a final value. The ordinary case should demonstrate “The result is [“fr-FR”, “en-US”]; the later canonical duplicate is omitted.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use a three-entry array with one duplicate and record each canonical step. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Ordinary arrays are processed by index, separate the documented JavaScript Intl.getCanonicalLocales() 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. The input contract is array-like, not general iterable

Back to contents

For non-string inputs the specification converts the value to an object and reads its array-like length and indexed properties. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is passing a Set and assuming its iterator will be consumed. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Compare a Set with an object that has length and numeric properties.

For the The input contract is array-like, not general iterable chapter on JavaScript Intl.getCanonicalLocales(), use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on passing a Set and assuming its iterator will be consumed. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

console.log(Intl.getCanonicalLocales(new Set(['en-US'])))
console.log(Intl.getCanonicalLocales({0:'en-us',length:1}))

Explained result. The Set has no array-like length and yields an empty list, while the indexed object yields [“en-US”]. 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: family language picker. Transfer the rule using submitted locale tags, duplicate choices and a stored preference. 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 “For non-string inputs the specification converts the value to an object and reads its array-like length and indexed properties.” Apply this procedure: Compare a Set with an object that has length and numeric properties. The expected mechanism is: The Set has no array-like length and yields an empty list, while the indexed object yields [“en-US”]. For the family language picker, add one near-miss that exposes passing a Set and assuming its iterator will be consumed. 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: school event page. Predict the rule using English, Malay, Chinese and Tamil interface requests. 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 “For non-string inputs the specification converts the value to an object and reads its array-like length and indexed properties.” Apply this procedure: Compare a Set with an object that has length and numeric properties. The expected mechanism is: The Set has no array-like length and yields an empty list, while the indexed object yields [“en-US”]. For the school event page, add one near-miss that exposes passing a Set and assuming its iterator will be consumed. 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: library catalogue. Contrast the rule using display locale, search locale and saved filter state. 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 “For non-string inputs the specification converts the value to an object and reads its array-like length and indexed properties.” Apply this procedure: Compare a Set with an object that has length and numeric properties. The expected mechanism is: The Set has no array-like length and yields an empty list, while the indexed object yields [“en-US”]. For the library catalogue, add one near-miss that exposes passing a Set and assuming its iterator will be consumed. 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: CCA registration. Stress-test the rule using browser preference, supported locales and fallback policy. 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 “For non-string inputs the specification converts the value to an object and reads its array-like length and indexed properties.” Apply this procedure: Compare a Set with an object that has length and numeric properties. The expected mechanism is: The Set has no array-like length and yields an empty list, while the indexed object yields [“en-US”]. For the CCA registration, add one near-miss that exposes passing a Set and assuming its iterator will be consumed. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.

Diagnostic route

  • Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
  • Boundary check: create the smallest input that triggers passing a Set and assuming its iterator will be consumed.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Compare a Set with an object that has length and numeric properties.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from The input contract is array-like, not general iterable?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing passing a Set and assuming its iterator will be consumed be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny school event page with English, Malay, Chinese and Tamil interface requests. Include one ordinary case, one boundary and one deliberate failure caused by passing a Set and assuming its iterator will be consumed. 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: For non-string inputs the specification converts the value to an object and reads its array-like length and indexed properties. It shows a trace, not only a final value. The ordinary case should demonstrate “The Set has no array-like length and yields an empty list, while the indexed object yields [“en-US”].” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Compare a Set with an object that has length and numeric properties. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For The input contract is array-like, not general iterable, separate the documented JavaScript Intl.getCanonicalLocales() 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. Canonical casing is structural

Back to contents

Canonicalization regularizes language, script and region casing according to locale-identifier 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 writing a home-made lowercase function that destroys conventional script and region casing. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use a language-script-region example and compare every subtag.

For the Canonical casing is structural chapter on JavaScript Intl.getCanonicalLocales(), 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 writing a home-made lowercase function that destroys conventional script and region casing. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

console.log(Intl.getCanonicalLocales('ZH-hant-tw'))

Explained result. The canonical result is zh-Hant-TW: language lower-case, script title-case and region upper-case. 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: library catalogue. Predict the rule using display locale, search locale and saved filter state. 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 “Canonicalization regularizes language, script and region casing according to locale-identifier rules.” Apply this procedure: Use a language-script-region example and compare every subtag. The expected mechanism is: The canonical result is zh-Hant-TW: language lower-case, script title-case and region upper-case. For the library catalogue, add one near-miss that exposes writing a home-made lowercase function that destroys conventional script and region casing. 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: CCA registration. Contrast the rule using browser preference, supported locales and fallback policy. 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 “Canonicalization regularizes language, script and region casing according to locale-identifier rules.” Apply this procedure: Use a language-script-region example and compare every subtag. The expected mechanism is: The canonical result is zh-Hant-TW: language lower-case, script title-case and region upper-case. For the CCA registration, add one near-miss that exposes writing a home-made lowercase function that destroys conventional script and region casing. 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: science dashboard. Stress-test the rule using number-format locale, unit display and canonical cache key. 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 “Canonicalization regularizes language, script and region casing according to locale-identifier rules.” Apply this procedure: Use a language-script-region example and compare every subtag. The expected mechanism is: The canonical result is zh-Hant-TW: language lower-case, script title-case and region upper-case. For the science dashboard, add one near-miss that exposes writing a home-made lowercase function that destroys conventional script and region casing. 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: travel worksheet. Explain the rule using region tags, script tags and translated labels. 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 “Canonicalization regularizes language, script and region casing according to locale-identifier rules.” Apply this procedure: Use a language-script-region example and compare every subtag. The expected mechanism is: The canonical result is zh-Hant-TW: language lower-case, script title-case and region upper-case. For the travel worksheet, add one near-miss that exposes writing a home-made lowercase function that destroys conventional script and region casing. 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 writing a home-made lowercase function that destroys conventional script and region casing.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Use a language-script-region example and compare every subtag.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Canonical casing is structural?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing writing a home-made lowercase function that destroys conventional script and region casing be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library catalogue with display locale, search locale and saved filter state. Include one ordinary case, one boundary and one deliberate failure caused by writing a home-made lowercase function that destroys conventional script and region casing. 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: Canonicalization regularizes language, script and region casing according to locale-identifier rules. It shows a trace, not only a final value. The ordinary case should demonstrate “The canonical result is zh-Hant-TW: language lower-case, script title-case and region upper-case.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use a language-script-region example and compare every subtag. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Canonical casing is structural, separate the documented JavaScript Intl.getCanonicalLocales() 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. Aliases can change spelling, not meaning

Back to contents

Canonicalization can replace deprecated or aliased subtags with their preferred canonical 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 treating canonicalization as cosmetic casing only. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Choose an alias case, verify it in the current runtime and store the returned value rather than a guessed rewrite.

For the Aliases can change spelling, not meaning chapter on JavaScript Intl.getCanonicalLocales(), 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 canonicalization as cosmetic casing only. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

console.log(Intl.getCanonicalLocales('iw-IL'))

Explained result. A conforming modern implementation returns the preferred language code he-IL. 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: science dashboard. Contrast the rule using number-format locale, unit display and canonical cache key. 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 “Canonicalization can replace deprecated or aliased subtags with their preferred canonical forms.” Apply this procedure: Choose an alias case, verify it in the current runtime and store the returned value rather than a guessed rewrite. The expected mechanism is: A conforming modern implementation returns the preferred language code he-IL. For the science dashboard, add one near-miss that exposes treating canonicalization as cosmetic casing only. 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: travel worksheet. Stress-test the rule using region tags, script tags and translated labels. 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 “Canonicalization can replace deprecated or aliased subtags with their preferred canonical forms.” Apply this procedure: Choose an alias case, verify it in the current runtime and store the returned value rather than a guessed rewrite. The expected mechanism is: A conforming modern implementation returns the preferred language code he-IL. For the travel worksheet, add one near-miss that exposes treating canonicalization as cosmetic casing only. 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 app. Explain the rule using user locale, content locale and formatter construction. 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 “Canonicalization can replace deprecated or aliased subtags with their preferred canonical forms.” Apply this procedure: Choose an alias case, verify it in the current runtime and store the returned value rather than a guessed rewrite. The expected mechanism is: A conforming modern implementation returns the preferred language code he-IL. For the revision app, add one near-miss that exposes treating canonicalization as cosmetic casing only. 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: test matrix. Transfer the rule using valid tags, invalid tags, aliases and duplicate canonical forms. 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 “Canonicalization can replace deprecated or aliased subtags with their preferred canonical forms.” Apply this procedure: Choose an alias case, verify it in the current runtime and store the returned value rather than a guessed rewrite. The expected mechanism is: A conforming modern implementation returns the preferred language code he-IL. For the test matrix, add one near-miss that exposes treating canonicalization as cosmetic casing only. 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 canonicalization as cosmetic casing only.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Choose an alias case, verify it in the current runtime and store the returned value rather than a guessed rewrite.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Aliases can change spelling, not meaning?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating canonicalization as cosmetic casing only be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA registration with browser preference, supported locales and fallback policy. Include one ordinary case, one boundary and one deliberate failure caused by treating canonicalization as cosmetic casing only. 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: Canonicalization can replace deprecated or aliased subtags with their preferred canonical forms. It shows a trace, not only a final value. The ordinary case should demonstrate “A conforming modern implementation returns the preferred language code he-IL.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Choose an alias case, verify it in the current runtime and store the returned value rather than a guessed rewrite. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Aliases can change spelling, not meaning, separate the documented JavaScript Intl.getCanonicalLocales() 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. Unicode extension keys are canonicalized

Back to contents

The -u- extension is parsed and canonicalized, including stable ordering of its attributes and key-value components. 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 preserving the author’s original extension order as if it were semantic. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Run two equivalent orderings and compare the canonical results.

For the Unicode extension keys are canonicalized chapter on JavaScript Intl.getCanonicalLocales(), 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 preserving the author’s original extension order as if it were semantic. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

console.log(Intl.getCanonicalLocales('de-u-co-phonebk-ca-gregory'))

Explained result. The canonical result orders the keys as de-u-ca-gregory-co-phonebk. 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 app. Stress-test the rule using user locale, content locale and formatter construction. 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 -u- extension is parsed and canonicalized, including stable ordering of its attributes and key-value components.” Apply this procedure: Run two equivalent orderings and compare the canonical results. The expected mechanism is: The canonical result orders the keys as de-u-ca-gregory-co-phonebk. For the revision app, add one near-miss that exposes preserving the author’s original extension order as if it were semantic. 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: test matrix. Explain the rule using valid tags, invalid tags, aliases and duplicate canonical forms. 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 -u- extension is parsed and canonicalized, including stable ordering of its attributes and key-value components.” Apply this procedure: Run two equivalent orderings and compare the canonical results. The expected mechanism is: The canonical result orders the keys as de-u-ca-gregory-co-phonebk. For the test matrix, add one near-miss that exposes preserving the author’s original extension order as if it were semantic. 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: family language picker. Transfer the rule using submitted locale tags, duplicate choices and a stored preference. 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 -u- extension is parsed and canonicalized, including stable ordering of its attributes and key-value components.” Apply this procedure: Run two equivalent orderings and compare the canonical results. The expected mechanism is: The canonical result orders the keys as de-u-ca-gregory-co-phonebk. For the family language picker, add one near-miss that exposes preserving the author’s original extension order as if it were semantic. 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: school event page. Predict the rule using English, Malay, Chinese and Tamil interface requests. 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 -u- extension is parsed and canonicalized, including stable ordering of its attributes and key-value components.” Apply this procedure: Run two equivalent orderings and compare the canonical results. The expected mechanism is: The canonical result orders the keys as de-u-ca-gregory-co-phonebk. For the school event page, add one near-miss that exposes preserving the author’s original extension order as if it were semantic. 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 preserving the author’s original extension order as if it were semantic.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Run two equivalent orderings and compare the canonical results.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Unicode extension keys are canonicalized?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing preserving the author’s original extension order as if it were semantic be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science dashboard with number-format locale, unit display and canonical cache key. Include one ordinary case, one boundary and one deliberate failure caused by preserving the author’s original extension order as if it were semantic. 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 -u- extension is parsed and canonicalized, including stable ordering of its attributes and key-value components. It shows a trace, not only a final value. The ordinary case should demonstrate “The canonical result orders the keys as de-u-ca-gregory-co-phonebk.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Run two equivalent orderings and compare the canonical results. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Unicode extension keys are canonicalized, separate the documented JavaScript Intl.getCanonicalLocales() 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. Canonical duplicates are removed

Back to contents

Duplicate detection happens after canonicalization, so differently cased or aliased inputs can collapse to one entry. 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 deduplicating raw strings first and leaving semantic duplicates. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Canonicalize first, then compare the returned list length with the source length.

For the Canonical duplicates are removed chapter on JavaScript Intl.getCanonicalLocales(), 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 deduplicating raw strings first and leaving semantic duplicates. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

console.log(Intl.getCanonicalLocales(['EN-us','en-US']))

Explained result. Only the first canonical en-US remains. 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: family language picker. Explain the rule using submitted locale tags, duplicate choices and a stored preference. 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 “Duplicate detection happens after canonicalization, so differently cased or aliased inputs can collapse to one entry.” Apply this procedure: Canonicalize first, then compare the returned list length with the source length. The expected mechanism is: Only the first canonical en-US remains. For the family language picker, add one near-miss that exposes deduplicating raw strings first and leaving semantic duplicates. 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: school event page. Transfer the rule using English, Malay, Chinese and Tamil interface requests. 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 “Duplicate detection happens after canonicalization, so differently cased or aliased inputs can collapse to one entry.” Apply this procedure: Canonicalize first, then compare the returned list length with the source length. The expected mechanism is: Only the first canonical en-US remains. For the school event page, add one near-miss that exposes deduplicating raw strings first and leaving semantic duplicates. 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: library catalogue. Predict the rule using display locale, search locale and saved filter state. 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 “Duplicate detection happens after canonicalization, so differently cased or aliased inputs can collapse to one entry.” Apply this procedure: Canonicalize first, then compare the returned list length with the source length. The expected mechanism is: Only the first canonical en-US remains. For the library catalogue, add one near-miss that exposes deduplicating raw strings first and leaving semantic duplicates. 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: CCA registration. Contrast the rule using browser preference, supported locales and fallback policy. 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 “Duplicate detection happens after canonicalization, so differently cased or aliased inputs can collapse to one entry.” Apply this procedure: Canonicalize first, then compare the returned list length with the source length. The expected mechanism is: Only the first canonical en-US remains. For the CCA registration, add one near-miss that exposes deduplicating raw strings first and leaving semantic duplicates. 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 deduplicating raw strings first and leaving semantic duplicates.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Canonicalize first, then compare the returned list length with the source length.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Canonical duplicates are removed?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing deduplicating raw strings first and leaving semantic duplicates be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny travel worksheet with region tags, script tags and translated labels. Include one ordinary case, one boundary and one deliberate failure caused by deduplicating raw strings first and leaving semantic duplicates. 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: Duplicate detection happens after canonicalization, so differently cased or aliased inputs can collapse to one entry. It shows a trace, not only a final value. The ordinary case should demonstrate “Only the first canonical en-US remains.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Canonicalize first, then compare the returned list length with the source length. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Canonical duplicates are removed, separate the documented JavaScript Intl.getCanonicalLocales() 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. First-seen order is preserved

Back to contents

When a canonical value has not yet been seen it is appended, and later duplicates do not move it. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.

The high-value mistake in this chapter is using the function as a sorting operation. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Trace the seen list after each source index.

For the First-seen order is preserved chapter on JavaScript Intl.getCanonicalLocales(), 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 the function as a sorting operation. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

console.log(Intl.getCanonicalLocales(['fr','en','FR','de']))

Explained result. The result is [“fr”, “en”, “de”] in first-canonical-occurrence 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: library catalogue. Transfer the rule using display locale, search locale and saved filter state. 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 a canonical value has not yet been seen it is appended, and later duplicates do not move it.” Apply this procedure: Trace the seen list after each source index. The expected mechanism is: The result is [“fr”, “en”, “de”] in first-canonical-occurrence order. For the library catalogue, add one near-miss that exposes using the function as a sorting operation. 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: CCA registration. Predict the rule using browser preference, supported locales and fallback policy. 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 a canonical value has not yet been seen it is appended, and later duplicates do not move it.” Apply this procedure: Trace the seen list after each source index. The expected mechanism is: The result is [“fr”, “en”, “de”] in first-canonical-occurrence order. For the CCA registration, add one near-miss that exposes using the function as a sorting operation. 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: science dashboard. Contrast the rule using number-format locale, unit display and canonical cache key. 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 a canonical value has not yet been seen it is appended, and later duplicates do not move it.” Apply this procedure: Trace the seen list after each source index. The expected mechanism is: The result is [“fr”, “en”, “de”] in first-canonical-occurrence order. For the science dashboard, add one near-miss that exposes using the function as a sorting operation. 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: travel worksheet. Stress-test the rule using region tags, script tags and translated labels. 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 a canonical value has not yet been seen it is appended, and later duplicates do not move it.” Apply this procedure: Trace the seen list after each source index. The expected mechanism is: The result is [“fr”, “en”, “de”] in first-canonical-occurrence order. For the travel worksheet, add one near-miss that exposes using the function as a sorting operation. 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 the function as a sorting operation.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Trace the seen list after each source index.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from First-seen order is preserved?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using the function as a sorting operation be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision app with user locale, content locale and formatter construction. Include one ordinary case, one boundary and one deliberate failure caused by using the function as a sorting operation. 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 a canonical value has not yet been seen it is appended, and later duplicates do not move it. It shows a trace, not only a final value. The ordinary case should demonstrate “The result is [“fr”, “en”, “de”] in first-canonical-occurrence order.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Trace the seen list after each source index. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For First-seen order is preserved, separate the documented JavaScript Intl.getCanonicalLocales() 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. Malformed tags raise RangeError

Back to contents

If an entry is not a well-formed language tag, canonicalization stops with a RangeError rather than returning a partial answer. 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 silently deleting invalid user input and losing the chance to explain it. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Validate at a form boundary, catch RangeError and report the specific submitted value separately.

For the Malformed tags raise RangeError chapter on JavaScript Intl.getCanonicalLocales(), 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 silently deleting invalid user input and losing the chance to explain it. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

try { Intl.getCanonicalLocales(['en-US','not_a_tag']); } catch(e) { console.log(e.name); }

Explained result. The call throws RangeError, so no canonical list is returned. 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: science dashboard. Predict the rule using number-format locale, unit display and canonical cache key. 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 “If an entry is not a well-formed language tag, canonicalization stops with a RangeError rather than returning a partial answer.” Apply this procedure: Validate at a form boundary, catch RangeError and report the specific submitted value separately. The expected mechanism is: The call throws RangeError, so no canonical list is returned. For the science dashboard, add one near-miss that exposes silently deleting invalid user input and losing the chance to explain it. 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: travel worksheet. Contrast the rule using region tags, script tags and translated labels. 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 “If an entry is not a well-formed language tag, canonicalization stops with a RangeError rather than returning a partial answer.” Apply this procedure: Validate at a form boundary, catch RangeError and report the specific submitted value separately. The expected mechanism is: The call throws RangeError, so no canonical list is returned. For the travel worksheet, add one near-miss that exposes silently deleting invalid user input and losing the chance to explain it. 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 app. Stress-test the rule using user locale, content locale and formatter construction. 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 “If an entry is not a well-formed language tag, canonicalization stops with a RangeError rather than returning a partial answer.” Apply this procedure: Validate at a form boundary, catch RangeError and report the specific submitted value separately. The expected mechanism is: The call throws RangeError, so no canonical list is returned. For the revision app, add one near-miss that exposes silently deleting invalid user input and losing the chance to explain it. 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: test matrix. Explain the rule using valid tags, invalid tags, aliases and duplicate canonical forms. 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 “If an entry is not a well-formed language tag, canonicalization stops with a RangeError rather than returning a partial answer.” Apply this procedure: Validate at a form boundary, catch RangeError and report the specific submitted value separately. The expected mechanism is: The call throws RangeError, so no canonical list is returned. For the test matrix, add one near-miss that exposes silently deleting invalid user input and losing the chance to explain it. 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 silently deleting invalid user input and losing the chance to explain it.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Validate at a form boundary, catch RangeError and report the specific submitted value separately.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Malformed tags raise RangeError?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing silently deleting invalid user input and losing the chance to explain it be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test matrix with valid tags, invalid tags, aliases and duplicate canonical forms. Include one ordinary case, one boundary and one deliberate failure caused by silently deleting invalid user input and losing the chance to explain it. 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: If an entry is not a well-formed language tag, canonicalization stops with a RangeError rather than returning a partial answer. It shows a trace, not only a final value. The ordinary case should demonstrate “The call throws RangeError, so no canonical list is returned.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Validate at a form boundary, catch RangeError and report the specific submitted value separately. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Malformed tags raise RangeError, separate the documented JavaScript Intl.getCanonicalLocales() 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. Primitive non-string entries raise TypeError

Back to contents

An indexed element that is neither a string nor an object causes TypeError before it can be mistaken for a language tag. 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 expecting the number 42 to become the string “42”. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Test the element-type boundary and convert only under an explicit application policy.

For the Primitive non-string entries raise TypeError chapter on JavaScript Intl.getCanonicalLocales(), 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 expecting the number 42 to become the string “42”. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

try { Intl.getCanonicalLocales([42]); } catch(e) { console.log(e.name); }

Explained result. The call throws TypeError because a number is not an accepted locale-list element. 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 app. Contrast the rule using user locale, content locale and formatter construction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An indexed element that is neither a string nor an object causes TypeError before it can be mistaken for a language tag.” Apply this procedure: Test the element-type boundary and convert only under an explicit application policy. The expected mechanism is: The call throws TypeError because a number is not an accepted locale-list element. For the revision app, add one near-miss that exposes expecting the number 42 to become the string “42”. 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: test matrix. Stress-test the rule using valid tags, invalid tags, aliases and duplicate canonical forms. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An indexed element that is neither a string nor an object causes TypeError before it can be mistaken for a language tag.” Apply this procedure: Test the element-type boundary and convert only under an explicit application policy. The expected mechanism is: The call throws TypeError because a number is not an accepted locale-list element. For the test matrix, add one near-miss that exposes expecting the number 42 to become the string “42”. 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: family language picker. Explain the rule using submitted locale tags, duplicate choices and a stored preference. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An indexed element that is neither a string nor an object causes TypeError before it can be mistaken for a language tag.” Apply this procedure: Test the element-type boundary and convert only under an explicit application policy. The expected mechanism is: The call throws TypeError because a number is not an accepted locale-list element. For the family language picker, add one near-miss that exposes expecting the number 42 to become the string “42”. 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: school event page. Transfer the rule using English, Malay, Chinese and Tamil interface requests. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An indexed element that is neither a string nor an object causes TypeError before it can be mistaken for a language tag.” Apply this procedure: Test the element-type boundary and convert only under an explicit application policy. The expected mechanism is: The call throws TypeError because a number is not an accepted locale-list element. For the school event page, add one near-miss that exposes expecting the number 42 to become the string “42”. 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 expecting the number 42 to become the string “42”.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Test the element-type boundary and convert only under an explicit application policy.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Primitive non-string entries raise TypeError?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing expecting the number 42 to become the string “42” be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family language picker with submitted locale tags, duplicate choices and a stored preference. Include one ordinary case, one boundary and one deliberate failure caused by expecting the number 42 to become the string “42”. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: An indexed element that is neither a string nor an object causes TypeError before it can be mistaken for a language tag. It shows a trace, not only a final value. The ordinary case should demonstrate “The call throws TypeError because a number is not an accepted locale-list element.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Test the element-type boundary and convert only under an explicit application policy. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Primitive non-string entries raise TypeError, separate the documented JavaScript Intl.getCanonicalLocales() 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. Null as the whole input also fails

Back to contents

A non-string locales value is converted to an object, and null or undefined cannot be converted in that branch; explicit null therefore throws. 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 null and omission interchangeably. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Define whether application absence is undefined, an empty array or a validated stored value.

For the Null as the whole input also fails chapter on JavaScript Intl.getCanonicalLocales(), 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 null and omission interchangeably. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

try { Intl.getCanonicalLocales(null); } catch(e) { console.log(e.name); }

Explained result. The explicit null input throws TypeError, unlike omitted or undefined input. 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: family language picker. Stress-test the rule using submitted locale tags, duplicate choices and a stored preference. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A non-string locales value is converted to an object, and null or undefined cannot be converted in that branch; explicit null therefore throws.” Apply this procedure: Define whether application absence is undefined, an empty array or a validated stored value. The expected mechanism is: The explicit null input throws TypeError, unlike omitted or undefined input. For the family language picker, add one near-miss that exposes using null and omission interchangeably. 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: school event page. Explain the rule using English, Malay, Chinese and Tamil interface requests. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A non-string locales value is converted to an object, and null or undefined cannot be converted in that branch; explicit null therefore throws.” Apply this procedure: Define whether application absence is undefined, an empty array or a validated stored value. The expected mechanism is: The explicit null input throws TypeError, unlike omitted or undefined input. For the school event page, add one near-miss that exposes using null and omission interchangeably. 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: library catalogue. Transfer the rule using display locale, search locale and saved filter state. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A non-string locales value is converted to an object, and null or undefined cannot be converted in that branch; explicit null therefore throws.” Apply this procedure: Define whether application absence is undefined, an empty array or a validated stored value. The expected mechanism is: The explicit null input throws TypeError, unlike omitted or undefined input. For the library catalogue, add one near-miss that exposes using null and omission interchangeably. 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: CCA registration. Predict the rule using browser preference, supported locales and fallback policy. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A non-string locales value is converted to an object, and null or undefined cannot be converted in that branch; explicit null therefore throws.” Apply this procedure: Define whether application absence is undefined, an empty array or a validated stored value. The expected mechanism is: The explicit null input throws TypeError, unlike omitted or undefined input. For the CCA registration, add one near-miss that exposes using null and omission interchangeably. 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 null and omission interchangeably.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Define whether application absence is undefined, an empty array or a validated stored value.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Null as the whole input also fails?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using null and omission interchangeably be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny school event page with English, Malay, Chinese and Tamil interface requests. Include one ordinary case, one boundary and one deliberate failure caused by using null and omission interchangeably. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: A non-string locales value is converted to an object, and null or undefined cannot be converted in that branch; explicit null therefore throws. It shows a trace, not only a final value. The ordinary case should demonstrate “The explicit null input throws TypeError, unlike omitted or undefined input.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Define whether application absence is undefined, an empty array or a validated stored value. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Null as the whole input also fails, separate the documented JavaScript Intl.getCanonicalLocales() 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. Intl.Locale objects carry initialized locale state

Back to contents

An Intl.Locale can be supplied directly or as an indexed element, and its initialized locale value enters the canonical list. 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 converting every locale object through an unrelated display label. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Pass the object and compare its toString value with the canonical output.

For the Intl.Locale objects carry initialized locale state chapter on JavaScript Intl.getCanonicalLocales(), 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 converting every locale object through an unrelated display label. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const loc=new Intl.Locale('zh-hant-tw');
console.log(Intl.getCanonicalLocales(loc))

Explained result. The result contains zh-Hant-TW from the Intl.Locale object. 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: library catalogue. Explain the rule using display locale, search locale and saved filter state. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An Intl.Locale can be supplied directly or as an indexed element, and its initialized locale value enters the canonical list.” Apply this procedure: Pass the object and compare its toString value with the canonical output. The expected mechanism is: The result contains zh-Hant-TW from the Intl.Locale object. For the library catalogue, add one near-miss that exposes converting every locale object through an unrelated display label. 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: CCA registration. Transfer the rule using browser preference, supported locales and fallback policy. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An Intl.Locale can be supplied directly or as an indexed element, and its initialized locale value enters the canonical list.” Apply this procedure: Pass the object and compare its toString value with the canonical output. The expected mechanism is: The result contains zh-Hant-TW from the Intl.Locale object. For the CCA registration, add one near-miss that exposes converting every locale object through an unrelated display label. 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: science dashboard. Predict the rule using number-format locale, unit display and canonical cache key. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An Intl.Locale can be supplied directly or as an indexed element, and its initialized locale value enters the canonical list.” Apply this procedure: Pass the object and compare its toString value with the canonical output. The expected mechanism is: The result contains zh-Hant-TW from the Intl.Locale object. For the science dashboard, add one near-miss that exposes converting every locale object through an unrelated display label. 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: travel worksheet. Contrast the rule using region tags, script tags and translated labels. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “An Intl.Locale can be supplied directly or as an indexed element, and its initialized locale value enters the canonical list.” Apply this procedure: Pass the object and compare its toString value with the canonical output. The expected mechanism is: The result contains zh-Hant-TW from the Intl.Locale object. For the travel worksheet, add one near-miss that exposes converting every locale object through an unrelated display label. 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 converting every locale object through an unrelated display label.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Pass the object and compare its toString value with the canonical output.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Intl.Locale objects carry initialized locale state?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing converting every locale object through an unrelated display label be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny library catalogue with display locale, search locale and saved filter state. Include one ordinary case, one boundary and one deliberate failure caused by converting every locale object through an unrelated display label. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: An Intl.Locale can be supplied directly or as an indexed element, and its initialized locale value enters the canonical list. It shows a trace, not only a final value. The ordinary case should demonstrate “The result contains zh-Hant-TW from the Intl.Locale object.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Pass the object and compare its toString value with the canonical output. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Intl.Locale objects carry initialized locale state, separate the documented JavaScript Intl.getCanonicalLocales() 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. Canonicalization does not test service availability

Back to contents

A well-formed canonical tag can still fall outside the locales an application ships or a particular service resolves exactly. 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 a language in the interface because canonicalization did not throw. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Follow with supportedLocalesOf or an application allow-list and define a fallback.

For the Canonicalization does not test service availability chapter on JavaScript Intl.getCanonicalLocales(), 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 a language in the interface because canonicalization did not throw. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const requested=Intl.getCanonicalLocales(['ban','id-ID']);
console.log(Intl.NumberFormat.supportedLocalesOf(requested))

Explained result. The second step, not getCanonicalLocales, reports what NumberFormat can support without falling back. 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: science dashboard. Transfer the rule using number-format locale, unit display and canonical cache key. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A well-formed canonical tag can still fall outside the locales an application ships or a particular service resolves exactly.” Apply this procedure: Follow with supportedLocalesOf or an application allow-list and define a fallback. The expected mechanism is: The second step, not getCanonicalLocales, reports what NumberFormat can support without falling back. For the science dashboard, add one near-miss that exposes showing a language in the interface because canonicalization did not throw. 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: travel worksheet. Predict the rule using region tags, script tags and translated labels. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A well-formed canonical tag can still fall outside the locales an application ships or a particular service resolves exactly.” Apply this procedure: Follow with supportedLocalesOf or an application allow-list and define a fallback. The expected mechanism is: The second step, not getCanonicalLocales, reports what NumberFormat can support without falling back. For the travel worksheet, add one near-miss that exposes showing a language in the interface because canonicalization did not throw. 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 app. Contrast the rule using user locale, content locale and formatter construction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A well-formed canonical tag can still fall outside the locales an application ships or a particular service resolves exactly.” Apply this procedure: Follow with supportedLocalesOf or an application allow-list and define a fallback. The expected mechanism is: The second step, not getCanonicalLocales, reports what NumberFormat can support without falling back. For the revision app, add one near-miss that exposes showing a language in the interface because canonicalization did not throw. 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: test matrix. Stress-test the rule using valid tags, invalid tags, aliases and duplicate canonical forms. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A well-formed canonical tag can still fall outside the locales an application ships or a particular service resolves exactly.” Apply this procedure: Follow with supportedLocalesOf or an application allow-list and define a fallback. The expected mechanism is: The second step, not getCanonicalLocales, reports what NumberFormat can support without falling back. For the test matrix, add one near-miss that exposes showing a language in the interface because canonicalization did not throw. 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 a language in the interface because canonicalization did not throw.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Follow with supportedLocalesOf or an application allow-list and define a 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Canonicalization does not test service availability?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing showing a language in the interface because canonicalization did not throw be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny CCA registration with browser preference, supported locales and fallback policy. Include one ordinary case, one boundary and one deliberate failure caused by showing a language in the interface because canonicalization did not throw. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: A well-formed canonical tag can still fall outside the locales an application ships or a particular service resolves exactly. It shows a trace, not only a final value. The ordinary case should demonstrate “The second step, not getCanonicalLocales, reports what NumberFormat can support without falling back.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Follow with supportedLocalesOf or an application allow-list and define a fallback. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Canonicalization does not test service availability, separate the documented JavaScript Intl.getCanonicalLocales() 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. Canonicalization is not locale negotiation

Back to contents

The function does not choose among requested locales, compare them with available locales or apply lookup versus best-fit matching. 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 taking the first canonical string as the selected interface locale. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Run a named matching policy after canonicalization and preserve the fallback chain.

For the Canonicalization is not locale negotiation chapter on JavaScript Intl.getCanonicalLocales(), 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 taking the first canonical string as the selected interface locale. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const requested=Intl.getCanonicalLocales(['fr-CA','en-SG']);

Explained result. requested is only the normalized preference list; selection still belongs to the application or Intl constructor. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.

Four purposeful transfer cases

Case 1: revision app. Predict the rule using user locale, content locale and formatter construction. 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 function does not choose among requested locales, compare them with available locales or apply lookup versus best-fit matching.” Apply this procedure: Run a named matching policy after canonicalization and preserve the fallback chain. The expected mechanism is: requested is only the normalized preference list; selection still belongs to the application or Intl constructor. For the revision app, add one near-miss that exposes taking the first canonical string as the selected interface 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: test matrix. Contrast the rule using valid tags, invalid tags, aliases and duplicate canonical forms. 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 function does not choose among requested locales, compare them with available locales or apply lookup versus best-fit matching.” Apply this procedure: Run a named matching policy after canonicalization and preserve the fallback chain. The expected mechanism is: requested is only the normalized preference list; selection still belongs to the application or Intl constructor. For the test matrix, add one near-miss that exposes taking the first canonical string as the selected interface 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: family language picker. Stress-test the rule using submitted locale tags, duplicate choices and a stored preference. 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 function does not choose among requested locales, compare them with available locales or apply lookup versus best-fit matching.” Apply this procedure: Run a named matching policy after canonicalization and preserve the fallback chain. The expected mechanism is: requested is only the normalized preference list; selection still belongs to the application or Intl constructor. For the family language picker, add one near-miss that exposes taking the first canonical string as the selected interface 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: school event page. Explain the rule using English, Malay, Chinese and Tamil interface requests. 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 function does not choose among requested locales, compare them with available locales or apply lookup versus best-fit matching.” Apply this procedure: Run a named matching policy after canonicalization and preserve the fallback chain. The expected mechanism is: requested is only the normalized preference list; selection still belongs to the application or Intl constructor. For the school event page, add one near-miss that exposes taking the first canonical string as the selected interface 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 taking the first canonical string as the selected interface locale.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Run a named matching policy after canonicalization and preserve the fallback chain.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Canonicalization is not locale negotiation?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing taking the first canonical string as the selected interface locale be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny science dashboard with number-format locale, unit display and canonical cache key. Include one ordinary case, one boundary and one deliberate failure caused by taking the first canonical string as the selected interface 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 function does not choose among requested locales, compare them with available locales or apply lookup versus best-fit matching. It shows a trace, not only a final value. The ordinary case should demonstrate “requested is only the normalized preference list; selection still belongs to the application or Intl constructor.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Run a named matching policy after canonicalization and preserve the fallback chain. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Canonicalization is not locale negotiation, separate the documented JavaScript Intl.getCanonicalLocales() 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. Canonicalization does not maximize subtags

Back to contents

The function preserves a canonical identifier but does not add likely script or region subtags; Intl.Locale.prototype.maximize has that separate job. 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 expecting “en” to become a particular region automatically. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Compare canonicalization with maximize and keep inference out of stored identity unless required.

For the Canonicalization does not maximize subtags chapter on JavaScript Intl.getCanonicalLocales(), 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 expecting “en” to become a particular region automatically. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const [tag]=Intl.getCanonicalLocales('en');
console.log(tag,new Intl.Locale(tag).maximize().toString())

Explained result. The canonical tag remains en, while maximize may produce a likely-subtag form such as en-Latn-US. 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: family language picker. Contrast the rule using submitted locale tags, duplicate choices and a stored preference. 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 function preserves a canonical identifier but does not add likely script or region subtags; Intl.Locale.prototype.maximize has that separate job.” Apply this procedure: Compare canonicalization with maximize and keep inference out of stored identity unless required. The expected mechanism is: The canonical tag remains en, while maximize may produce a likely-subtag form such as en-Latn-US. For the family language picker, add one near-miss that exposes expecting “en” to become a particular region automatically. 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: school event page. Stress-test the rule using English, Malay, Chinese and Tamil interface requests. 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 function preserves a canonical identifier but does not add likely script or region subtags; Intl.Locale.prototype.maximize has that separate job.” Apply this procedure: Compare canonicalization with maximize and keep inference out of stored identity unless required. The expected mechanism is: The canonical tag remains en, while maximize may produce a likely-subtag form such as en-Latn-US. For the school event page, add one near-miss that exposes expecting “en” to become a particular region automatically. 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: library catalogue. Explain the rule using display locale, search locale and saved filter state. 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 function preserves a canonical identifier but does not add likely script or region subtags; Intl.Locale.prototype.maximize has that separate job.” Apply this procedure: Compare canonicalization with maximize and keep inference out of stored identity unless required. The expected mechanism is: The canonical tag remains en, while maximize may produce a likely-subtag form such as en-Latn-US. For the library catalogue, add one near-miss that exposes expecting “en” to become a particular region automatically. 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: CCA registration. Transfer the rule using browser preference, supported locales and fallback policy. 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 function preserves a canonical identifier but does not add likely script or region subtags; Intl.Locale.prototype.maximize has that separate job.” Apply this procedure: Compare canonicalization with maximize and keep inference out of stored identity unless required. The expected mechanism is: The canonical tag remains en, while maximize may produce a likely-subtag form such as en-Latn-US. For the CCA registration, add one near-miss that exposes expecting “en” to become a particular region automatically. 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 expecting “en” to become a particular region automatically.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Compare canonicalization with maximize and keep inference out of stored identity unless required.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Canonicalization does not maximize subtags?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing expecting “en” to become a particular region automatically be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny travel worksheet with region tags, script tags and translated labels. Include one ordinary case, one boundary and one deliberate failure caused by expecting “en” to become a particular region automatically. 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 function preserves a canonical identifier but does not add likely script or region subtags; Intl.Locale.prototype.maximize has that separate job. It shows a trace, not only a final value. The ordinary case should demonstrate “The canonical tag remains en, while maximize may produce a likely-subtag form such as en-Latn-US.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Compare canonicalization with maximize and keep inference out of stored identity unless required. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Canonicalization does not maximize subtags, separate the documented JavaScript Intl.getCanonicalLocales() 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. Use canonical tags as cache keys with context

Back to contents

Canonical output reduces spelling variants, but formatter options, data versions and application policy still affect cached results. 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 the locale alone as a cache key for every number, date and collation configuration. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Include service name and normalized options in the cache key.

For the Use canonical tags as cache keys with context chapter on JavaScript Intl.getCanonicalLocales(), 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 the locale alone as a cache key for every number, date and collation configuration. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const [locale]=Intl.getCanonicalLocales('EN-us');
const key=JSON.stringify(['number',locale,{style:'percent'}]);

Explained result. The key distinguishes a number-percent formatter in en-US from other Intl services 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: library catalogue. Stress-test the rule using display locale, search locale and saved filter state. 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 “Canonical output reduces spelling variants, but formatter options, data versions and application policy still affect cached results.” Apply this procedure: Include service name and normalized options in the cache key. The expected mechanism is: The key distinguishes a number-percent formatter in en-US from other Intl services and options. For the library catalogue, add one near-miss that exposes using the locale alone as a cache key for every number, date and collation configuration. 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: CCA registration. Explain the rule using browser preference, supported locales and fallback policy. 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 “Canonical output reduces spelling variants, but formatter options, data versions and application policy still affect cached results.” Apply this procedure: Include service name and normalized options in the cache key. The expected mechanism is: The key distinguishes a number-percent formatter in en-US from other Intl services and options. For the CCA registration, add one near-miss that exposes using the locale alone as a cache key for every number, date and collation configuration. 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: science dashboard. Transfer the rule using number-format locale, unit display and canonical cache key. 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 “Canonical output reduces spelling variants, but formatter options, data versions and application policy still affect cached results.” Apply this procedure: Include service name and normalized options in the cache key. The expected mechanism is: The key distinguishes a number-percent formatter in en-US from other Intl services and options. For the science dashboard, add one near-miss that exposes using the locale alone as a cache key for every number, date and collation configuration. 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: travel worksheet. Predict the rule using region tags, script tags and translated labels. 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 “Canonical output reduces spelling variants, but formatter options, data versions and application policy still affect cached results.” Apply this procedure: Include service name and normalized options in the cache key. The expected mechanism is: The key distinguishes a number-percent formatter in en-US from other Intl services and options. For the travel worksheet, add one near-miss that exposes using the locale alone as a cache key for every number, date and collation configuration. 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 the locale alone as a cache key for every number, date and collation configuration.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Include service name and normalized options in the cache key.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Use canonical tags as cache keys with context?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using the locale alone as a cache key for every number, date and collation configuration be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny revision app with user locale, content locale and formatter construction. Include one ordinary case, one boundary and one deliberate failure caused by using the locale alone as a cache key for every number, date and collation configuration. 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: Canonical output reduces spelling variants, but formatter options, data versions and application policy still affect cached results. It shows a trace, not only a final value. The ordinary case should demonstrate “The key distinguishes a number-percent formatter in en-US from other Intl services and options.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Include service name and normalized options in the cache key. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Use canonical tags as cache keys with context, separate the documented JavaScript Intl.getCanonicalLocales() 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. Preserve raw input when feedback matters

Back to contents

Canonical tags are useful internal values, while the original submission may be needed to explain a correction or show a precise validation error. 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 overwriting raw form input before a user can see what was wrong. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Store raw and canonical values at different stages and never claim they are interchangeable evidence.

For the Preserve raw input when feedback matters chapter on JavaScript Intl.getCanonicalLocales(), 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 overwriting raw form input before a user can see what was wrong. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const raw='ZH-hant-tw';
const canonical=Intl.getCanonicalLocales(raw)[0];

Explained result. raw preserves what was entered; canonical provides zh-Hant-TW for subsequent processing. 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: science dashboard. Explain the rule using number-format locale, unit display and canonical cache key. 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 “Canonical tags are useful internal values, while the original submission may be needed to explain a correction or show a precise validation error.” Apply this procedure: Store raw and canonical values at different stages and never claim they are interchangeable evidence. The expected mechanism is: raw preserves what was entered; canonical provides zh-Hant-TW for subsequent processing. For the science dashboard, add one near-miss that exposes overwriting raw form input before a user can see what was wrong. 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: travel worksheet. Transfer the rule using region tags, script tags and translated labels. 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 “Canonical tags are useful internal values, while the original submission may be needed to explain a correction or show a precise validation error.” Apply this procedure: Store raw and canonical values at different stages and never claim they are interchangeable evidence. The expected mechanism is: raw preserves what was entered; canonical provides zh-Hant-TW for subsequent processing. For the travel worksheet, add one near-miss that exposes overwriting raw form input before a user can see what was wrong. 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 app. Predict the rule using user locale, content locale and formatter construction. 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 “Canonical tags are useful internal values, while the original submission may be needed to explain a correction or show a precise validation error.” Apply this procedure: Store raw and canonical values at different stages and never claim they are interchangeable evidence. The expected mechanism is: raw preserves what was entered; canonical provides zh-Hant-TW for subsequent processing. For the revision app, add one near-miss that exposes overwriting raw form input before a user can see what was wrong. 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: test matrix. Contrast the rule using valid tags, invalid tags, aliases and duplicate canonical forms. 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 “Canonical tags are useful internal values, while the original submission may be needed to explain a correction or show a precise validation error.” Apply this procedure: Store raw and canonical values at different stages and never claim they are interchangeable evidence. The expected mechanism is: raw preserves what was entered; canonical provides zh-Hant-TW for subsequent processing. For the test matrix, add one near-miss that exposes overwriting raw form input before a user can see what was wrong. 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 overwriting raw form input before a user can see what was wrong.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Store raw and canonical values at different stages and never claim they are interchangeable evidence.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Preserve raw input when feedback matters?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing overwriting raw form input before a user can see what was wrong be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny test matrix with valid tags, invalid tags, aliases and duplicate canonical forms. Include one ordinary case, one boundary and one deliberate failure caused by overwriting raw form input before a user can see what was wrong. 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: Canonical tags are useful internal values, while the original submission may be needed to explain a correction or show a precise validation error. It shows a trace, not only a final value. The ordinary case should demonstrate “raw preserves what was entered; canonical provides zh-Hant-TW for subsequent processing.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Store raw and canonical values at different stages and never claim they are interchangeable evidence. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Preserve raw input when feedback matters, separate the documented JavaScript Intl.getCanonicalLocales() 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. Test the complete locale pipeline

Back to contents

A trustworthy suite covers omission, one string, array-like objects, casing, aliases, extensions, duplicates, malformed tags, wrong element types, support checks and fallback. 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 testing only en-US and assuming every stage is solved. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Assert error classes, order and stage boundaries as well as returned strings.

For the Test the complete locale pipeline chapter on JavaScript Intl.getCanonicalLocales(), 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 testing only en-US and assuming every stage is solved. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.

Core worked example

const cases=['EN-us','zh-hant-tw','de-u-co-phonebk-ca-gregory'];

Explained result. The matrix distinguishes canonicalization facts from availability, matching, inference and user-interface policy. 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 app. Transfer the rule using user locale, content locale and formatter construction. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A trustworthy suite covers omission, one string, array-like objects, casing, aliases, extensions, duplicates, malformed tags, wrong element types, support checks and fallback.” Apply this procedure: Assert error classes, order and stage boundaries as well as returned strings. The expected mechanism is: The matrix distinguishes canonicalization facts from availability, matching, inference and user-interface policy. For the revision app, add one near-miss that exposes testing only en-US and assuming every stage is solved. 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: test matrix. Predict the rule using valid tags, invalid tags, aliases and duplicate canonical forms. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A trustworthy suite covers omission, one string, array-like objects, casing, aliases, extensions, duplicates, malformed tags, wrong element types, support checks and fallback.” Apply this procedure: Assert error classes, order and stage boundaries as well as returned strings. The expected mechanism is: The matrix distinguishes canonicalization facts from availability, matching, inference and user-interface policy. For the test matrix, add one near-miss that exposes testing only en-US and assuming every stage is solved. 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: family language picker. Contrast the rule using submitted locale tags, duplicate choices and a stored preference. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A trustworthy suite covers omission, one string, array-like objects, casing, aliases, extensions, duplicates, malformed tags, wrong element types, support checks and fallback.” Apply this procedure: Assert error classes, order and stage boundaries as well as returned strings. The expected mechanism is: The matrix distinguishes canonicalization facts from availability, matching, inference and user-interface policy. For the family language picker, add one near-miss that exposes testing only en-US and assuming every stage is solved. 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: school event page. Stress-test the rule using English, Malay, Chinese and Tamil interface requests. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.

Reasoned route. Begin with “A trustworthy suite covers omission, one string, array-like objects, casing, aliases, extensions, duplicates, malformed tags, wrong element types, support checks and fallback.” Apply this procedure: Assert error classes, order and stage boundaries as well as returned strings. The expected mechanism is: The matrix distinguishes canonicalization facts from availability, matching, inference and user-interface policy. For the school event page, add one near-miss that exposes testing only en-US and assuming every stage is solved. 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 testing only en-US and assuming every stage is solved.
  • Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
  • Repair check: use the reversible procedure “Assert error classes, order and stage boundaries as well as returned strings.” 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.getCanonicalLocales() syntax. For this chapter, useful prompts are: “What did you expect from Test the complete locale pipeline?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing testing only en-US and assuming every stage is solved be made smaller?” The learner, not the parent, should supply the technical explanation.

Practice with an explained answer

Question. Build a tiny family language picker with submitted locale tags, duplicate choices and a stored preference. Include one ordinary case, one boundary and one deliberate failure caused by testing only en-US and assuming every stage is solved. Predict each result before using a tool, then report the first point where observation differs from prediction.

Answer guide. A strong response starts with the rule: A trustworthy suite covers omission, one string, array-like objects, casing, aliases, extensions, duplicates, malformed tags, wrong element types, support checks and fallback. It shows a trace, not only a final value. The ordinary case should demonstrate “The matrix distinguishes canonicalization facts from availability, matching, inference and user-interface policy.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Assert error classes, order and stage boundaries as well as returned strings. Other data choices are valid when the evidence supports the same causal chain.

Decision and transfer

For Test the complete locale pipeline, separate the documented JavaScript Intl.getCanonicalLocales() 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. family language picker: model, boundary and recovery

Create a small family language picker using submitted locale tags, duplicate choices and a stored preference. Combine “Canonicalization has one focused job” 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 function turns a locale input into a validated, canonical, duplicate-free array of locale identifiers. Apply: Write separate pipeline stages for canonicalization, support testing, matching and display. Verify: The result is [“en-US”, “fr-FR”] with canonical casing and preserved 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.

2. school event page: model, boundary and recovery

Create a small school event page using English, Malay, Chinese and Tamil interface requests. Combine “Ordinary arrays are processed by index” with one later chapter. Include an ordinary case, a boundary, a deliberate failure and a recovery. Write the expected state before each operation.

Explained route. Start with: An array supplies locale entries in indexed order, and the output follows the first occurrence of each canonical value. Apply: Use a three-entry array with one duplicate and record each canonical step. Verify: The result is [“fr-FR”, “en-US”]; the later canonical duplicate is omitted. 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. library catalogue: model, boundary and recovery

Create a small library catalogue using display locale, search locale and saved filter state. Combine “Aliases can change spelling, not meaning” 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: Canonicalization can replace deprecated or aliased subtags with their preferred canonical forms. Apply: Choose an alias case, verify it in the current runtime and store the returned value rather than a guessed rewrite. Verify: A conforming modern implementation returns the preferred language code he-IL. 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. CCA registration: model, boundary and recovery

Create a small CCA registration using browser preference, supported locales and fallback policy. Combine “First-seen order is preserved” 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 a canonical value has not yet been seen it is appended, and later duplicates do not move it. Apply: Trace the seen list after each source index. Verify: The result is [“fr”, “en”, “de”] in first-canonical-occurrence 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.

5. science dashboard: model, boundary and recovery

Create a small science dashboard using number-format locale, unit display and canonical cache key. Combine “Null as the whole input also fails” 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: A non-string locales value is converted to an object, and null or undefined cannot be converted in that branch; explicit null therefore throws. Apply: Define whether application absence is undefined, an empty array or a validated stored value. Verify: The explicit null input throws TypeError, unlike omitted or undefined input. 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. travel worksheet: model, boundary and recovery

Create a small travel worksheet using region tags, script tags and translated labels. Combine “Canonicalization is not locale negotiation” 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 function does not choose among requested locales, compare them with available locales or apply lookup versus best-fit matching. Apply: Run a named matching policy after canonicalization and preserve the fallback chain. Verify: requested is only the normalized preference list; selection still belongs to the application or Intl constructor. 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. revision app: model, boundary and recovery

Create a small revision app using user locale, content locale and formatter construction. Combine “Preserve raw input when feedback matters” 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: Canonical tags are useful internal values, while the original submission may be needed to explain a correction or show a precise validation error. Apply: Store raw and canonical values at different stages and never claim they are interchangeable evidence. Verify: raw preserves what was entered; canonical provides zh-Hant-TW for subsequent processing. 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. test matrix: model, boundary and recovery

Create a small test matrix using valid tags, invalid tags, aliases and duplicate canonical forms. Combine “Undefined means an empty request list” 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 the locales argument is undefined or omitted, the canonicalized locale list is empty. Apply: Compare omission with constructing an Intl formatter that performs its own default-locale selection. Verify: The function returns an empty array; it does not insert the runtime default. 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 的更多信息

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

继续阅读