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.
Intl.Locale turns a locale identifier into a structured, canonical locale object. It can expose language, script, region and variants, carry Unicode extension preferences, add or remove likely subtags, and report locale-dependent calendars, numbering systems, time zones, week data and text direction where supported. Mastery means treating locale as user preference metadata rather than a flag, country or translation guarantee. 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
Complete chapter index
Chapters 1-4 . Build the model
Chapters 5-8 . Use the core tools
Chapters 9-12 . Handle boundaries
Chapters 13-16 . Debug and verify
Chapters 17-20 . Transfer with judgment
Construction validates and canonicalises a BCP 47 tag while retaining locale semantics for later Intl APIs. 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 input as an arbitrary underscore-separated language string. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Construct one valid tag, print toString and inspect components.
For the Intl.Locale parses a locale identifier chapter on JavaScript Intl.Locale, 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 input as an arbitrary underscore-separated language string. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const loc=new Intl.Locale('en-sg');
console.log(loc.toString(),loc.language,loc.region);Explained result. The canonical string is en-SG, with language en and region SG. 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 portal. Predict the rule using carrying language and regional preferences across a Punggol household. 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 “Construction validates and canonicalises a BCP 47 tag while retaining locale semantics for later Intl APIs.” Apply this procedure: Construct one valid tag, print toString and inspect components. The expected mechanism is: The canonical string is en-SG, with language en and region SG. For the family portal, add one near-miss that exposes treating input as an arbitrary underscore-separated language string. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Case 2: school calendar. Contrast the rule using reasoning about first day, weekend and regional conventions. 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 “Construction validates and canonicalises a BCP 47 tag while retaining locale semantics for later Intl APIs.” Apply this procedure: Construct one valid tag, print toString and inspect components. The expected mechanism is: The canonical string is en-SG, with language en and region SG. For the school calendar, add one near-miss that exposes treating input as an arbitrary underscore-separated language string. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Case 3: reading interface. Stress-test the rule using choosing text direction and display 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 “Construction validates and canonicalises a BCP 47 tag while retaining locale semantics for later Intl APIs.” Apply this procedure: Construct one valid tag, print toString and inspect components. The expected mechanism is: The canonical string is en-SG, with language en and region SG. For the reading interface, add one near-miss that exposes treating input as an arbitrary underscore-separated language string. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Case 4: mathematics app. Explain the rule using passing numbering-system preferences to formatters. 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 “Construction validates and canonicalises a BCP 47 tag while retaining locale semantics for later Intl APIs.” Apply this procedure: Construct one valid tag, print toString and inspect components. The expected mechanism is: The canonical string is en-SG, with language en and region SG. For the mathematics app, add one near-miss that exposes treating input as an arbitrary underscore-separated language string. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Diagnostic route
- Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
- Boundary check: create the smallest input that triggers treating input as an arbitrary underscore-separated language string.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Construct one valid tag, print toString and inspect components.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Intl.Locale parses a locale identifier?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating input as an arbitrary underscore-separated language string be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny data import with canonicalising and validating stored locale tags. Include one ordinary case, one boundary and one deliberate failure caused by treating input as an arbitrary underscore-separated language string. Predict each result before using a tool, then report the first point where observation differs from prediction.
Answer guide. A strong response starts with the rule: Construction validates and canonicalises a BCP 47 tag while retaining locale semantics for later Intl APIs. It shows a trace, not only a final value. The ordinary case should demonstrate “The canonical string is en-SG, with language en and region SG.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Construct one valid tag, print toString and inspect components. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Intl.Locale parses a locale identifier, separate the documented JavaScript Intl.Locale 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
Language identifies a linguistic form, script a writing system and region regional conventions; none proves a user location. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.
The high-value mistake in this chapter is reading region as GPS location or language as nationality. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Label each subtag and the limited decision it may influence.
For the Language, script and region are different chapter on JavaScript Intl.Locale, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on reading region as GPS location or language as nationality. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const loc=new Intl.Locale('zh-Hans-SG');
console.log(loc.language,loc.script,loc.region);Explained result. The components are zh, Hans and SG; they are preference metadata, not a biography. 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: reading interface. Contrast the rule using choosing text direction and display 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 “Language identifies a linguistic form, script a writing system and region regional conventions; none proves a user location.” Apply this procedure: Label each subtag and the limited decision it may influence. The expected mechanism is: The components are zh, Hans and SG; they are preference metadata, not a biography. For the reading interface, add one near-miss that exposes reading region as GPS location or language as nationality. 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: mathematics app. Stress-test the rule using passing numbering-system preferences to formatters. 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 “Language identifies a linguistic form, script a writing system and region regional conventions; none proves a user location.” Apply this procedure: Label each subtag and the limited decision it may influence. The expected mechanism is: The components are zh, Hans and SG; they are preference metadata, not a biography. For the mathematics app, add one near-miss that exposes reading region as GPS location or language as nationality. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Case 3: travel plan. Explain the rule using separating language, script, region and time-zone choices. 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 “Language identifies a linguistic form, script a writing system and region regional conventions; none proves a user location.” Apply this procedure: Label each subtag and the limited decision it may influence. The expected mechanism is: The components are zh, Hans and SG; they are preference metadata, not a biography. For the travel plan, add one near-miss that exposes reading region as GPS location or language as nationality. 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: data import. Transfer the rule using canonicalising and validating stored locale tags. 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 “Language identifies a linguistic form, script a writing system and region regional conventions; none proves a user location.” Apply this procedure: Label each subtag and the limited decision it may influence. The expected mechanism is: The components are zh, Hans and SG; they are preference metadata, not a biography. For the data import, add one near-miss that exposes reading region as GPS location or language as nationality. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Diagnostic route
- Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
- Boundary check: create the smallest input that triggers reading region as GPS location or language as nationality.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Label each subtag and the limited decision it may influence.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Language, script and region are different?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing reading region as GPS location or language as nationality be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny test laboratory with checking likely subtags, extensions, arrays and unsupported tags. Include one ordinary case, one boundary and one deliberate failure caused by reading region as GPS location or language as nationality. 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: Language identifies a linguistic form, script a writing system and region regional conventions; none proves a user location. It shows a trace, not only a final value. The ordinary case should demonstrate “The components are zh, Hans and SG; they are preference metadata, not a biography.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Label each subtag and the limited decision it may influence. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Language, script and region are different, separate the documented JavaScript Intl.Locale 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
Canonicalisation regularises casing and preferred tag representation but does not create translations or verify resources. 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 claiming a canonical tag means the app has a matching translation. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Canonicalise the identifier, then check the resource catalogue separately.
For the Canonicalisation does not translate content chapter on JavaScript Intl.Locale, 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 claiming a canonical tag means the app has a matching translation. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
console.log(new Intl.Locale('EN-sg').toString());Explained result. The result is en-SG; no message catalogue was created. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.
Four purposeful transfer cases
Case 1: travel plan. Stress-test the rule using separating language, script, region and time-zone choices. 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 “Canonicalisation regularises casing and preferred tag representation but does not create translations or verify resources.” Apply this procedure: Canonicalise the identifier, then check the resource catalogue separately. The expected mechanism is: The result is en-SG; no message catalogue was created. For the travel plan, add one near-miss that exposes claiming a canonical tag means the app has a matching translation. 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: data import. Explain the rule using canonicalising and validating stored locale tags. 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 “Canonicalisation regularises casing and preferred tag representation but does not create translations or verify resources.” Apply this procedure: Canonicalise the identifier, then check the resource catalogue separately. The expected mechanism is: The result is en-SG; no message catalogue was created. For the data import, add one near-miss that exposes claiming a canonical tag means the app has a matching translation. 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: test laboratory. Transfer the rule using checking likely subtags, extensions, arrays and unsupported tags. 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 “Canonicalisation regularises casing and preferred tag representation but does not create translations or verify resources.” Apply this procedure: Canonicalise the identifier, then check the resource catalogue separately. The expected mechanism is: The result is en-SG; no message catalogue was created. For the test laboratory, add one near-miss that exposes claiming a canonical tag means the app has a matching translation. 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: design review. Predict the rule using separating locale, translation, geography and identity. 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 “Canonicalisation regularises casing and preferred tag representation but does not create translations or verify resources.” Apply this procedure: Canonicalise the identifier, then check the resource catalogue separately. The expected mechanism is: The result is en-SG; no message catalogue was created. For the design review, add one near-miss that exposes claiming a canonical tag means the app has a matching translation. 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 claiming a canonical tag means the app has a matching translation.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Canonicalise the identifier, then check the resource catalogue 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Canonicalisation does not translate content?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing claiming a canonical tag means the app has a matching translation be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny design review with separating locale, translation, geography and identity. Include one ordinary case, one boundary and one deliberate failure caused by claiming a canonical tag means the app has a matching translation. 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: Canonicalisation regularises casing and preferred tag representation but does not create translations or verify resources. It shows a trace, not only a final value. The ordinary case should demonstrate “The result is en-SG; no message catalogue was created.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Canonicalise the identifier, then check the resource catalogue separately. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Canonicalisation does not translate content, separate the documented JavaScript Intl.Locale 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
Constructor options can set language, script, region and Unicode-related preferences to produce a new Locale. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.
The high-value mistake in this chapter is mutating an existing Locale as if it were a settings record. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Construct a second Locale from the first plus options and compare strings.
For the Options can add or override fields chapter on JavaScript Intl.Locale, 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 mutating an existing Locale as if it were a settings record. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const a=new Intl.Locale('en');
const b=new Intl.Locale(a,{region:'SG'});
console.log(a.toString(),b.toString());Explained result. The original remains en and the new object is en-SG. 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: test laboratory. Explain the rule using checking likely subtags, extensions, arrays and unsupported tags. 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 “Constructor options can set language, script, region and Unicode-related preferences to produce a new Locale.” Apply this procedure: Construct a second Locale from the first plus options and compare strings. The expected mechanism is: The original remains en and the new object is en-SG. For the test laboratory, add one near-miss that exposes mutating an existing Locale as if it were a settings record. 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: design review. Transfer the rule using separating locale, translation, geography and identity. 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 “Constructor options can set language, script, region and Unicode-related preferences to produce a new Locale.” Apply this procedure: Construct a second Locale from the first plus options and compare strings. The expected mechanism is: The original remains en and the new object is en-SG. For the design review, add one near-miss that exposes mutating an existing Locale as if it were a settings record. 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 portal. Predict the rule using carrying language and regional preferences across a Punggol household. 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 “Constructor options can set language, script, region and Unicode-related preferences to produce a new Locale.” Apply this procedure: Construct a second Locale from the first plus options and compare strings. The expected mechanism is: The original remains en and the new object is en-SG. For the family portal, add one near-miss that exposes mutating an existing Locale as if it were a settings record. 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 calendar. Contrast the rule using reasoning about first day, weekend and regional conventions. 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 “Constructor options can set language, script, region and Unicode-related preferences to produce a new Locale.” Apply this procedure: Construct a second Locale from the first plus options and compare strings. The expected mechanism is: The original remains en and the new object is en-SG. For the school calendar, add one near-miss that exposes mutating an existing Locale as if it were a settings record. 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 mutating an existing Locale as if it were a settings record.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Construct a second Locale from the first plus options and compare 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Options can add or override fields?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing mutating an existing Locale as if it were a settings record be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny family portal with carrying language and regional preferences across a Punggol household. Include one ordinary case, one boundary and one deliberate failure caused by mutating an existing Locale as if it were a settings record. 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: Constructor options can set language, script, region and Unicode-related preferences to produce a new Locale. It shows a trace, not only a final value. The ordinary case should demonstrate “The original remains en and the new object is en-SG.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Construct a second Locale from the first plus options and compare strings. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Options can add or override fields, separate the documented JavaScript Intl.Locale 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
Exposed properties read initialized locale data; semantic changes require constructing another Locale. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.
The high-value mistake in this chapter is assigning loc.region and expecting downstream formatters to change. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Keep application state outside and construct a replacement value.
For the Locale objects are immutable values chapter on JavaScript Intl.Locale, 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 assigning loc.region and expecting downstream formatters to change. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const loc=new Intl.Locale('en-SG');
console.log(loc.region);Explained result. Reading reports SG; replacement requires a new Locale rather than mutation. 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 portal. Transfer the rule using carrying language and regional preferences across a Punggol household. 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 “Exposed properties read initialized locale data; semantic changes require constructing another Locale.” Apply this procedure: Keep application state outside and construct a replacement value. The expected mechanism is: Reading reports SG; replacement requires a new Locale rather than mutation. For the family portal, add one near-miss that exposes assigning loc.region and expecting downstream formatters to change. 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 calendar. Predict the rule using reasoning about first day, weekend and regional conventions. 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 “Exposed properties read initialized locale data; semantic changes require constructing another Locale.” Apply this procedure: Keep application state outside and construct a replacement value. The expected mechanism is: Reading reports SG; replacement requires a new Locale rather than mutation. For the school calendar, add one near-miss that exposes assigning loc.region and expecting downstream formatters to change. 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: reading interface. Contrast the rule using choosing text direction and display 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 “Exposed properties read initialized locale data; semantic changes require constructing another Locale.” Apply this procedure: Keep application state outside and construct a replacement value. The expected mechanism is: Reading reports SG; replacement requires a new Locale rather than mutation. For the reading interface, add one near-miss that exposes assigning loc.region and expecting downstream formatters to change. 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: mathematics app. Stress-test the rule using passing numbering-system preferences to formatters. 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 “Exposed properties read initialized locale data; semantic changes require constructing another Locale.” Apply this procedure: Keep application state outside and construct a replacement value. The expected mechanism is: Reading reports SG; replacement requires a new Locale rather than mutation. For the mathematics app, add one near-miss that exposes assigning loc.region and expecting downstream formatters to change. 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 assigning loc.region and expecting downstream formatters to change.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Keep application state outside and construct a replacement 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Locale objects are immutable values?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assigning loc.region and expecting downstream formatters to change be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny school calendar with reasoning about first day, weekend and regional conventions. Include one ordinary case, one boundary and one deliberate failure caused by assigning loc.region and expecting downstream formatters to change. 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: Exposed properties read initialized locale data; semantic changes require constructing another Locale. It shows a trace, not only a final value. The ordinary case should demonstrate “Reading reports SG; replacement requires a new Locale rather than mutation.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Keep application state outside and construct a replacement value. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Locale objects are immutable values, separate the documented JavaScript Intl.Locale 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
Calendar, collation, hour cycle, case-first, numbering system and numeric preferences may be encoded in the 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 concatenating extension text without knowing supported keys. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use constructor options and inspect the canonical string and properties.
For the Unicode extensions carry preferences chapter on JavaScript Intl.Locale, 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 concatenating extension text without knowing supported keys. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const loc=new Intl.Locale('en-SG',{hourCycle:'h23',numberingSystem:'latn'});
console.log(loc.hourCycle,loc.numberingSystem,loc.toString());Explained result. The object exposes h23 and latn and serialises their extension preferences. 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: reading interface. Predict the rule using choosing text direction and display 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 “Calendar, collation, hour cycle, case-first, numbering system and numeric preferences may be encoded in the tag.” Apply this procedure: Use constructor options and inspect the canonical string and properties. The expected mechanism is: The object exposes h23 and latn and serialises their extension preferences. For the reading interface, add one near-miss that exposes concatenating extension text without knowing supported keys. 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: mathematics app. Contrast the rule using passing numbering-system preferences to formatters. 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 “Calendar, collation, hour cycle, case-first, numbering system and numeric preferences may be encoded in the tag.” Apply this procedure: Use constructor options and inspect the canonical string and properties. The expected mechanism is: The object exposes h23 and latn and serialises their extension preferences. For the mathematics app, add one near-miss that exposes concatenating extension text without knowing supported keys. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Case 3: travel plan. Stress-test the rule using separating language, script, region and time-zone choices. 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 “Calendar, collation, hour cycle, case-first, numbering system and numeric preferences may be encoded in the tag.” Apply this procedure: Use constructor options and inspect the canonical string and properties. The expected mechanism is: The object exposes h23 and latn and serialises their extension preferences. For the travel plan, add one near-miss that exposes concatenating extension text without knowing supported keys. 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: data import. Explain the rule using canonicalising and validating stored locale tags. 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 “Calendar, collation, hour cycle, case-first, numbering system and numeric preferences may be encoded in the tag.” Apply this procedure: Use constructor options and inspect the canonical string and properties. The expected mechanism is: The object exposes h23 and latn and serialises their extension preferences. For the data import, add one near-miss that exposes concatenating extension text without knowing supported keys. 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 concatenating extension text without knowing supported keys.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Use constructor options and inspect the canonical string and 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Unicode extensions carry preferences?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing concatenating extension text without knowing supported keys be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny reading interface with choosing text direction and display labels. Include one ordinary case, one boundary and one deliberate failure caused by concatenating extension text without knowing supported keys. 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: Calendar, collation, hour cycle, case-first, numbering system and numeric preferences may be encoded in the tag. It shows a trace, not only a final value. The ordinary case should demonstrate “The object exposes h23 and latn and serialises their extension preferences.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use constructor options and inspect the canonical string and properties. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Unicode extensions carry preferences, separate the documented JavaScript Intl.Locale 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
The numeric option requests numeric-aware collation where a collator uses the locale; it does not parse numbers. 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 Locale.numeric as validation or arithmetic. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Pass the locale to Intl.Collator and compare digit-containing labels.
For the numeric is a collation preference chapter on JavaScript Intl.Locale, 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 Locale.numeric as validation or arithmetic. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const loc=new Intl.Locale('en',{numeric:true});
console.log(new Intl.Collator(loc).compare('item2','item10'));Explained result. The negative result orders 2 before 10; the values remain strings. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.
Four purposeful transfer cases
Case 1: travel plan. Contrast the rule using separating language, script, region and time-zone choices. 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 numeric option requests numeric-aware collation where a collator uses the locale; it does not parse numbers.” Apply this procedure: Pass the locale to Intl.Collator and compare digit-containing labels. The expected mechanism is: The negative result orders 2 before 10; the values remain strings. For the travel plan, add one near-miss that exposes using Locale.numeric as validation or arithmetic. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Case 2: data import. Stress-test the rule using canonicalising and validating stored locale tags. 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 numeric option requests numeric-aware collation where a collator uses the locale; it does not parse numbers.” Apply this procedure: Pass the locale to Intl.Collator and compare digit-containing labels. The expected mechanism is: The negative result orders 2 before 10; the values remain strings. For the data import, add one near-miss that exposes using Locale.numeric as validation or arithmetic. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Case 3: test laboratory. Explain the rule using checking likely subtags, extensions, arrays and unsupported tags. 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 numeric option requests numeric-aware collation where a collator uses the locale; it does not parse numbers.” Apply this procedure: Pass the locale to Intl.Collator and compare digit-containing labels. The expected mechanism is: The negative result orders 2 before 10; the values remain strings. For the test laboratory, add one near-miss that exposes using Locale.numeric as validation or arithmetic. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Case 4: design review. Transfer the rule using separating locale, translation, geography and identity. 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 numeric option requests numeric-aware collation where a collator uses the locale; it does not parse numbers.” Apply this procedure: Pass the locale to Intl.Collator and compare digit-containing labels. The expected mechanism is: The negative result orders 2 before 10; the values remain strings. For the design review, add one near-miss that exposes using Locale.numeric as validation or arithmetic. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Diagnostic route
- Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
- Boundary check: create the smallest input that triggers using Locale.numeric as validation or arithmetic.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Pass the locale to Intl.Collator and compare digit-containing labels.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from numeric is a collation preference?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using Locale.numeric as validation or arithmetic be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny mathematics app with passing numbering-system preferences to formatters. Include one ordinary case, one boundary and one deliberate failure caused by using Locale.numeric as validation or arithmetic. Predict each result before using a tool, then report the first point where observation differs from prediction.
Answer guide. A strong response starts with the rule: The numeric option requests numeric-aware collation where a collator uses the locale; it does not parse numbers. It shows a trace, not only a final value. The ordinary case should demonstrate “The negative result orders 2 before 10; the values remain strings.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Pass the locale to Intl.Collator and compare digit-containing labels. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For numeric is a collation preference, separate the documented JavaScript Intl.Locale 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
maximize applies likely-subtag data and returns a new Locale, often filling script and region. 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 likely subtags as verified facts about the user. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Compare minimal and maximized strings and label additions as defaults.
For the maximize adds likely subtags chapter on JavaScript Intl.Locale, 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 likely subtags as verified facts about the user. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const a=new Intl.Locale('zh');
console.log(a.toString(),a.maximize().toString());Explained result. The added script and region are an inference from locale data, not user testimony. 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: test laboratory. Stress-test the rule using checking likely subtags, extensions, arrays and unsupported tags. 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 “maximize applies likely-subtag data and returns a new Locale, often filling script and region.” Apply this procedure: Compare minimal and maximized strings and label additions as defaults. The expected mechanism is: The added script and region are an inference from locale data, not user testimony. For the test laboratory, add one near-miss that exposes treating likely subtags as verified facts about the user. 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: design review. Explain the rule using separating locale, translation, geography and identity. 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 “maximize applies likely-subtag data and returns a new Locale, often filling script and region.” Apply this procedure: Compare minimal and maximized strings and label additions as defaults. The expected mechanism is: The added script and region are an inference from locale data, not user testimony. For the design review, add one near-miss that exposes treating likely subtags as verified facts about the user. 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 portal. Transfer the rule using carrying language and regional preferences across a Punggol household. 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 “maximize applies likely-subtag data and returns a new Locale, often filling script and region.” Apply this procedure: Compare minimal and maximized strings and label additions as defaults. The expected mechanism is: The added script and region are an inference from locale data, not user testimony. For the family portal, add one near-miss that exposes treating likely subtags as verified facts about the user. 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 calendar. Predict the rule using reasoning about first day, weekend and regional conventions. 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 “maximize applies likely-subtag data and returns a new Locale, often filling script and region.” Apply this procedure: Compare minimal and maximized strings and label additions as defaults. The expected mechanism is: The added script and region are an inference from locale data, not user testimony. For the school calendar, add one near-miss that exposes treating likely subtags as verified facts about the user. 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 likely subtags as verified facts about the user.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Compare minimal and maximized strings and label additions as defaults.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from maximize adds likely subtags?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing treating likely subtags as verified facts about the user be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny travel plan with separating language, script, region and time-zone choices. Include one ordinary case, one boundary and one deliberate failure caused by treating likely subtags as verified facts about the user. 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: maximize applies likely-subtag data and returns a new Locale, often filling script and region. It shows a trace, not only a final value. The ordinary case should demonstrate “The added script and region are an inference from locale data, not user testimony.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Compare minimal and maximized strings and label additions as defaults. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For maximize adds likely subtags, separate the documented JavaScript Intl.Locale 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
minimize removes subtags when likely-subtag reconstruction preserves the same maximized form. 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 minimize as generic string shortening. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Verify that original and minimized locales maximize to the same form.
For the minimize removes redundant subtags chapter on JavaScript Intl.Locale, 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 minimize as generic string shortening. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const a=new Intl.Locale('en-Latn-US');
const b=a.minimize();
console.log(b.toString(),b.maximize().toString());Explained result. The concise locale can be en while maximizing back to the corresponding likely form. 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 portal. Explain the rule using carrying language and regional preferences across a Punggol household. 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 “minimize removes subtags when likely-subtag reconstruction preserves the same maximized form.” Apply this procedure: Verify that original and minimized locales maximize to the same form. The expected mechanism is: The concise locale can be en while maximizing back to the corresponding likely form. For the family portal, add one near-miss that exposes using minimize as generic string shortening. 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 calendar. Transfer the rule using reasoning about first day, weekend and regional conventions. 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 “minimize removes subtags when likely-subtag reconstruction preserves the same maximized form.” Apply this procedure: Verify that original and minimized locales maximize to the same form. The expected mechanism is: The concise locale can be en while maximizing back to the corresponding likely form. For the school calendar, add one near-miss that exposes using minimize as generic string shortening. 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: reading interface. Predict the rule using choosing text direction and display 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 “minimize removes subtags when likely-subtag reconstruction preserves the same maximized form.” Apply this procedure: Verify that original and minimized locales maximize to the same form. The expected mechanism is: The concise locale can be en while maximizing back to the corresponding likely form. For the reading interface, add one near-miss that exposes using minimize as generic string shortening. 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: mathematics app. Contrast the rule using passing numbering-system preferences to formatters. 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 “minimize removes subtags when likely-subtag reconstruction preserves the same maximized form.” Apply this procedure: Verify that original and minimized locales maximize to the same form. The expected mechanism is: The concise locale can be en while maximizing back to the corresponding likely form. For the mathematics app, add one near-miss that exposes using minimize as generic string shortening. 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 minimize as generic string shortening.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Verify that original and minimized locales maximize to the same form.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from minimize removes redundant subtags?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using minimize as generic string shortening be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny data import with canonicalising and validating stored locale tags. Include one ordinary case, one boundary and one deliberate failure caused by using minimize as generic string shortening. 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: minimize removes subtags when likely-subtag reconstruction preserves the same maximized form. It shows a trace, not only a final value. The ordinary case should demonstrate “The concise locale can be en while maximizing back to the corresponding likely form.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Verify that original and minimized locales maximize to the same form. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For minimize removes redundant subtags, separate the documented JavaScript Intl.Locale 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
Both methods construct Locale objects and leave the source unchanged. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.
The high-value mistake in this chapter is calling maximize then reading added fields from the original. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Store the returned value and print both objects.
For the maximize and minimize do not mutate chapter on JavaScript Intl.Locale, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on calling maximize then reading added fields from the original. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const a=new Intl.Locale('en');
const b=a.maximize();
console.log(a.region,b.region);Explained result. The original can have undefined region while the maximized value has a likely region. 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: reading interface. Transfer the rule using choosing text direction and display 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 “Both methods construct Locale objects and leave the source unchanged.” Apply this procedure: Store the returned value and print both objects. The expected mechanism is: The original can have undefined region while the maximized value has a likely region. For the reading interface, add one near-miss that exposes calling maximize then reading added fields from the original. 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: mathematics app. Predict the rule using passing numbering-system preferences to formatters. 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 “Both methods construct Locale objects and leave the source unchanged.” Apply this procedure: Store the returned value and print both objects. The expected mechanism is: The original can have undefined region while the maximized value has a likely region. For the mathematics app, add one near-miss that exposes calling maximize then reading added fields from the original. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Case 3: travel plan. Contrast the rule using separating language, script, region and time-zone choices. 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 “Both methods construct Locale objects and leave the source unchanged.” Apply this procedure: Store the returned value and print both objects. The expected mechanism is: The original can have undefined region while the maximized value has a likely region. For the travel plan, add one near-miss that exposes calling maximize then reading added fields from the original. 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: data import. Stress-test the rule using canonicalising and validating stored locale tags. 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 “Both methods construct Locale objects and leave the source unchanged.” Apply this procedure: Store the returned value and print both objects. The expected mechanism is: The original can have undefined region while the maximized value has a likely region. For the data import, add one near-miss that exposes calling maximize then reading added fields from the original. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Diagnostic route
- Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
- Boundary check: create the smallest input that triggers calling maximize then reading added fields from the original.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Store the returned value and print both objects.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from maximize and minimize do not mutate?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing calling maximize then reading added fields from the original be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny test laboratory with checking likely subtags, extensions, arrays and unsupported tags. Include one ordinary case, one boundary and one deliberate failure caused by calling maximize then reading added fields from the original. 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: Both methods construct Locale objects and leave the source unchanged. It shows a trace, not only a final value. The ordinary case should demonstrate “The original can have undefined region while the maximized value has a likely region.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Store the returned value and print both objects. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For maximize and minimize do not mutate, separate the documented JavaScript Intl.Locale 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
toString returns the internal locale identifier and is safer than manually rebuilding 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 losing variants or extensions through string surgery. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Round-trip toString through a new Locale.
For the toString is the canonical interchange form chapter on JavaScript Intl.Locale, 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 losing variants or extensions through string surgery. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const a=new Intl.Locale('en-SG-u-hc-h23');
const b=new Intl.Locale(a.toString());
console.log(a.toString()===b.toString());Explained result. The canonical string round-trips to the same identifier. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.
Four purposeful transfer cases
Case 1: travel plan. Predict the rule using separating language, script, region and time-zone choices. 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 “toString returns the internal locale identifier and is safer than manually rebuilding components.” Apply this procedure: Round-trip toString through a new Locale. The expected mechanism is: The canonical string round-trips to the same identifier. For the travel plan, add one near-miss that exposes losing variants or extensions through string surgery. 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: data import. Contrast the rule using canonicalising and validating stored locale tags. 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 “toString returns the internal locale identifier and is safer than manually rebuilding components.” Apply this procedure: Round-trip toString through a new Locale. The expected mechanism is: The canonical string round-trips to the same identifier. For the data import, add one near-miss that exposes losing variants or extensions through string surgery. 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: test laboratory. Stress-test the rule using checking likely subtags, extensions, arrays and unsupported tags. 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 “toString returns the internal locale identifier and is safer than manually rebuilding components.” Apply this procedure: Round-trip toString through a new Locale. The expected mechanism is: The canonical string round-trips to the same identifier. For the test laboratory, add one near-miss that exposes losing variants or extensions through string surgery. 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: design review. Explain the rule using separating locale, translation, geography and identity. 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 “toString returns the internal locale identifier and is safer than manually rebuilding components.” Apply this procedure: Round-trip toString through a new Locale. The expected mechanism is: The canonical string round-trips to the same identifier. For the design review, add one near-miss that exposes losing variants or extensions through string surgery. 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 losing variants or extensions through string surgery.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Round-trip toString through a new Locale.” and record the first changed observation.
- Transfer check: repeat the rule in a second context and identify what remains invariant.
A parent does not need to know the final JavaScript Intl.Locale syntax. For this chapter, useful prompts are: “What did you expect from toString is the canonical interchange form?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing losing variants or extensions through string surgery be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny design review with separating locale, translation, geography and identity. Include one ordinary case, one boundary and one deliberate failure caused by losing variants or extensions through string surgery. 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: toString returns the internal locale identifier and is safer than manually rebuilding components. It shows a trace, not only a final value. The ordinary case should demonstrate “The canonical string round-trips to the same identifier.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Round-trip toString through a new Locale. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For toString is the canonical interchange form, separate the documented JavaScript Intl.Locale 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
baseName contains language, script, region and variants without Unicode extension settings. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.
The high-value mistake in this chapter is using baseName when a cache must distinguish calendar preferences. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Print baseName beside the full string and name each cache decision.
For the baseName excludes Unicode extensions chapter on JavaScript Intl.Locale, 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 baseName when a cache must distinguish calendar preferences. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const loc=new Intl.Locale('en-SG-u-ca-gregory');
console.log(loc.baseName,loc.toString());Explained result. baseName is en-SG while the full string retains the calendar extension. 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: test laboratory. Contrast the rule using checking likely subtags, extensions, arrays and unsupported tags. 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 “baseName contains language, script, region and variants without Unicode extension settings.” Apply this procedure: Print baseName beside the full string and name each cache decision. The expected mechanism is: baseName is en-SG while the full string retains the calendar extension. For the test laboratory, add one near-miss that exposes using baseName when a cache must distinguish calendar preferences. 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: design review. Stress-test the rule using separating locale, translation, geography and identity. 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 “baseName contains language, script, region and variants without Unicode extension settings.” Apply this procedure: Print baseName beside the full string and name each cache decision. The expected mechanism is: baseName is en-SG while the full string retains the calendar extension. For the design review, add one near-miss that exposes using baseName when a cache must distinguish calendar preferences. 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 portal. Explain the rule using carrying language and regional preferences across a Punggol household. 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 “baseName contains language, script, region and variants without Unicode extension settings.” Apply this procedure: Print baseName beside the full string and name each cache decision. The expected mechanism is: baseName is en-SG while the full string retains the calendar extension. For the family portal, add one near-miss that exposes using baseName when a cache must distinguish calendar preferences. 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 calendar. Transfer the rule using reasoning about first day, weekend and regional conventions. 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 “baseName contains language, script, region and variants without Unicode extension settings.” Apply this procedure: Print baseName beside the full string and name each cache decision. The expected mechanism is: baseName is en-SG while the full string retains the calendar extension. For the school calendar, add one near-miss that exposes using baseName when a cache must distinguish calendar preferences. 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 baseName when a cache must distinguish calendar preferences.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Print baseName beside the full string and name each cache decision.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from baseName excludes Unicode extensions?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using baseName when a cache must distinguish calendar preferences be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny family portal with carrying language and regional preferences across a Punggol household. Include one ordinary case, one boundary and one deliberate failure caused by using baseName when a cache must distinguish calendar preferences. 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: baseName contains language, script, region and variants without Unicode extension settings. It shows a trace, not only a final value. The ordinary case should demonstrate “baseName is en-SG while the full string retains the calendar extension.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Print baseName beside the full string and name each cache decision. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For baseName excludes Unicode extensions, separate the documented JavaScript Intl.Locale 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
Where implemented, getWeekInfo returns first day, weekend and minimal days from locale data. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.
The high-value mistake in this chapter is hard-coding one familiar week globally. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Query the locale and keep business rules separate from display defaults.
For the getWeekInfo reports regional conventions chapter on JavaScript Intl.Locale, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on hard-coding one familiar week globally. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const loc=new Intl.Locale('en-SG');
console.log(loc.getWeekInfo?.());Explained result. A supporting runtime returns firstDay, weekend and minimalDays. 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 portal. Stress-test the rule using carrying language and regional preferences across a Punggol household. 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 “Where implemented, getWeekInfo returns first day, weekend and minimal days from locale data.” Apply this procedure: Query the locale and keep business rules separate from display defaults. The expected mechanism is: A supporting runtime returns firstDay, weekend and minimalDays. For the family portal, add one near-miss that exposes hard-coding one familiar week globally. 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 calendar. Explain the rule using reasoning about first day, weekend and regional conventions. 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 “Where implemented, getWeekInfo returns first day, weekend and minimal days from locale data.” Apply this procedure: Query the locale and keep business rules separate from display defaults. The expected mechanism is: A supporting runtime returns firstDay, weekend and minimalDays. For the school calendar, add one near-miss that exposes hard-coding one familiar week globally. 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: reading interface. Transfer the rule using choosing text direction and display 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 “Where implemented, getWeekInfo returns first day, weekend and minimal days from locale data.” Apply this procedure: Query the locale and keep business rules separate from display defaults. The expected mechanism is: A supporting runtime returns firstDay, weekend and minimalDays. For the reading interface, add one near-miss that exposes hard-coding one familiar week globally. 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: mathematics app. Predict the rule using passing numbering-system preferences to formatters. 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 “Where implemented, getWeekInfo returns first day, weekend and minimal days from locale data.” Apply this procedure: Query the locale and keep business rules separate from display defaults. The expected mechanism is: A supporting runtime returns firstDay, weekend and minimalDays. For the mathematics app, add one near-miss that exposes hard-coding one familiar week globally. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Diagnostic route
- Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
- Boundary check: create the smallest input that triggers hard-coding one familiar week globally.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Query the locale and keep business rules separate from display defaults.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from getWeekInfo reports regional conventions?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing hard-coding one familiar week globally be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny school calendar with reasoning about first day, weekend and regional conventions. Include one ordinary case, one boundary and one deliberate failure caused by hard-coding one familiar week globally. 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: Where implemented, getWeekInfo returns first day, weekend and minimal days from locale data. It shows a trace, not only a final value. The ordinary case should demonstrate “A supporting runtime returns firstDay, weekend and minimalDays.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Query the locale and keep business rules separate from display defaults. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For getWeekInfo reports regional conventions, separate the documented JavaScript Intl.Locale 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
getTextInfo can report ltr or rtl, informing layout without replacing semantic HTML direction handling. 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 guessing direction from the first two tag letters. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Query the API and test RTL and LTR interfaces.
For the getTextInfo reports direction chapter on JavaScript Intl.Locale, 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 guessing direction from the first two tag letters. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
console.log(new Intl.Locale('ar').getTextInfo?.().direction);
console.log(new Intl.Locale('en').getTextInfo?.().direction);Explained result. Supporting runtimes report rtl for Arabic and ltr for English. 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: reading interface. Explain the rule using choosing text direction and display 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 “getTextInfo can report ltr or rtl, informing layout without replacing semantic HTML direction handling.” Apply this procedure: Query the API and test RTL and LTR interfaces. The expected mechanism is: Supporting runtimes report rtl for Arabic and ltr for English. For the reading interface, add one near-miss that exposes guessing direction from the first two tag letters. 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: mathematics app. Transfer the rule using passing numbering-system preferences to formatters. 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 “getTextInfo can report ltr or rtl, informing layout without replacing semantic HTML direction handling.” Apply this procedure: Query the API and test RTL and LTR interfaces. The expected mechanism is: Supporting runtimes report rtl for Arabic and ltr for English. For the mathematics app, add one near-miss that exposes guessing direction from the first two tag letters. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Case 3: travel plan. Predict the rule using separating language, script, region and time-zone choices. 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 “getTextInfo can report ltr or rtl, informing layout without replacing semantic HTML direction handling.” Apply this procedure: Query the API and test RTL and LTR interfaces. The expected mechanism is: Supporting runtimes report rtl for Arabic and ltr for English. For the travel plan, add one near-miss that exposes guessing direction from the first two tag letters. 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: data import. Contrast the rule using canonicalising and validating stored locale tags. 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 “getTextInfo can report ltr or rtl, informing layout without replacing semantic HTML direction handling.” Apply this procedure: Query the API and test RTL and LTR interfaces. The expected mechanism is: Supporting runtimes report rtl for Arabic and ltr for English. For the data import, add one near-miss that exposes guessing direction from the first two tag letters. 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 guessing direction from the first two tag letters.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Query the API and test RTL and LTR interfaces.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from getTextInfo reports direction?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing guessing direction from the first two tag letters be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny reading interface with choosing text direction and display labels. Include one ordinary case, one boundary and one deliberate failure caused by guessing direction from the first two tag letters. 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: getTextInfo can report ltr or rtl, informing layout without replacing semantic HTML direction handling. It shows a trace, not only a final value. The ordinary case should demonstrate “Supporting runtimes report rtl for Arabic and ltr for English.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Query the API and test RTL and LTR interfaces. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For getTextInfo reports direction, separate the documented JavaScript Intl.Locale 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
Methods can report calendars, collations, hour cycles, numbering systems and time zones relevant to a locale. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.
The high-value mistake in this chapter is assuming the first item is the only valid user choice. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Treat results as capabilities and let explicit settings override defaults.
For the Locale data methods return preference arrays chapter on JavaScript Intl.Locale, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on assuming the first item is the only valid user choice. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const loc=new Intl.Locale('en-SG');
console.log(loc.getCalendars?.(),loc.getNumberingSystems?.());Explained result. Supporting runtimes return arrays; the application still needs a choice 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: travel plan. Transfer the rule using separating language, script, region and time-zone choices. 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 “Methods can report calendars, collations, hour cycles, numbering systems and time zones relevant to a locale.” Apply this procedure: Treat results as capabilities and let explicit settings override defaults. The expected mechanism is: Supporting runtimes return arrays; the application still needs a choice policy. For the travel plan, add one near-miss that exposes assuming the first item is the only valid user choice. 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: data import. Predict the rule using canonicalising and validating stored locale tags. 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 “Methods can report calendars, collations, hour cycles, numbering systems and time zones relevant to a locale.” Apply this procedure: Treat results as capabilities and let explicit settings override defaults. The expected mechanism is: Supporting runtimes return arrays; the application still needs a choice policy. For the data import, add one near-miss that exposes assuming the first item is the only valid user choice. 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: test laboratory. Contrast the rule using checking likely subtags, extensions, arrays and unsupported tags. 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 “Methods can report calendars, collations, hour cycles, numbering systems and time zones relevant to a locale.” Apply this procedure: Treat results as capabilities and let explicit settings override defaults. The expected mechanism is: Supporting runtimes return arrays; the application still needs a choice policy. For the test laboratory, add one near-miss that exposes assuming the first item is the only valid user choice. 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: design review. Stress-test the rule using separating locale, translation, geography and identity. 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 “Methods can report calendars, collations, hour cycles, numbering systems and time zones relevant to a locale.” Apply this procedure: Treat results as capabilities and let explicit settings override defaults. The expected mechanism is: Supporting runtimes return arrays; the application still needs a choice policy. For the design review, add one near-miss that exposes assuming the first item is the only valid user choice. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Diagnostic route
- Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
- Boundary check: create the smallest input that triggers assuming the first item is the only valid user choice.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Treat results as capabilities and let explicit settings override defaults.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Locale data methods return preference arrays?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming the first item is the only valid user choice be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny mathematics app with passing numbering-system preferences to formatters. Include one ordinary case, one boundary and one deliberate failure caused by assuming the first item is the only valid user choice. 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: Methods can report calendars, collations, hour cycles, numbering systems and time zones relevant to a locale. It shows a trace, not only a final value. The ordinary case should demonstrate “Supporting runtimes return arrays; the application still needs a choice policy.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Treat results as capabilities and let explicit settings override defaults. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Locale data methods return preference arrays, separate the documented JavaScript Intl.Locale 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
getTimeZones can return undefined without a region because time-zone lists are regional. 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 a language tag to identify one clock setting. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Add a region explicitly and compare observations.
For the Language alone may not yield time zones chapter on JavaScript Intl.Locale, 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 a language tag to identify one clock setting. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const a=new Intl.Locale('en');
const b=new Intl.Locale('en-SG');
console.log(a.getTimeZones?.(),b.getTimeZones?.()?.length);Explained result. The language-only result may be undefined while the regional locale supplies a list. 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: test laboratory. Predict the rule using checking likely subtags, extensions, arrays and unsupported tags. 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 “getTimeZones can return undefined without a region because time-zone lists are regional.” Apply this procedure: Add a region explicitly and compare observations. The expected mechanism is: The language-only result may be undefined while the regional locale supplies a list. For the test laboratory, add one near-miss that exposes expecting a language tag to identify one clock setting. 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: design review. Contrast the rule using separating locale, translation, geography and identity. 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 “getTimeZones can return undefined without a region because time-zone lists are regional.” Apply this procedure: Add a region explicitly and compare observations. The expected mechanism is: The language-only result may be undefined while the regional locale supplies a list. For the design review, add one near-miss that exposes expecting a language tag to identify one clock setting. 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 portal. Stress-test the rule using carrying language and regional preferences across a Punggol household. 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 “getTimeZones can return undefined without a region because time-zone lists are regional.” Apply this procedure: Add a region explicitly and compare observations. The expected mechanism is: The language-only result may be undefined while the regional locale supplies a list. For the family portal, add one near-miss that exposes expecting a language tag to identify one clock setting. 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 calendar. Explain the rule using reasoning about first day, weekend and regional conventions. 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 “getTimeZones can return undefined without a region because time-zone lists are regional.” Apply this procedure: Add a region explicitly and compare observations. The expected mechanism is: The language-only result may be undefined while the regional locale supplies a list. For the school calendar, add one near-miss that exposes expecting a language tag to identify one clock setting. 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 a language tag to identify one clock setting.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Add a region explicitly and compare observations.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Language alone may not yield time zones?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing expecting a language tag to identify one clock setting be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny travel plan with separating language, script, region and time-zone choices. Include one ordinary case, one boundary and one deliberate failure caused by expecting a language tag to identify one clock setting. 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: getTimeZones can return undefined without a region because time-zone lists are regional. It shows a trace, not only a final value. The ordinary case should demonstrate “The language-only result may be undefined while the regional locale supplies a list.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Add a region explicitly and compare observations. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Language alone may not yield time zones, separate the documented JavaScript Intl.Locale 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
Intl constructors accept Locale objects through locale-list processing, avoiding manual string surgery. 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 extracting only language and discarding other preferences. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use the complete Locale and inspect resolvedOptions.
For the Pass Locale objects to Intl formatters chapter on JavaScript Intl.Locale, 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 extracting only language and discarding other preferences. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const loc=new Intl.Locale('en-SG',{numberingSystem:'latn'});
const nf=new Intl.NumberFormat(loc,{style:'currency',currency:'SGD'});
console.log(nf.resolvedOptions().locale);Explained result. The formatter resolves a supported locale and relevant preferences. 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 portal. Contrast the rule using carrying language and regional preferences across a Punggol household. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.
Reasoned route. Begin with “Intl constructors accept Locale objects through locale-list processing, avoiding manual string surgery.” Apply this procedure: Use the complete Locale and inspect resolvedOptions. The expected mechanism is: The formatter resolves a supported locale and relevant preferences. For the family portal, add one near-miss that exposes extracting only language and discarding other preferences. 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 calendar. Stress-test the rule using reasoning about first day, weekend and regional conventions. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.
Reasoned route. Begin with “Intl constructors accept Locale objects through locale-list processing, avoiding manual string surgery.” Apply this procedure: Use the complete Locale and inspect resolvedOptions. The expected mechanism is: The formatter resolves a supported locale and relevant preferences. For the school calendar, add one near-miss that exposes extracting only language and discarding other preferences. 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: reading interface. Explain the rule using choosing text direction and display 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 “Intl constructors accept Locale objects through locale-list processing, avoiding manual string surgery.” Apply this procedure: Use the complete Locale and inspect resolvedOptions. The expected mechanism is: The formatter resolves a supported locale and relevant preferences. For the reading interface, add one near-miss that exposes extracting only language and discarding other preferences. 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: mathematics app. Transfer the rule using passing numbering-system preferences to formatters. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.
Reasoned route. Begin with “Intl constructors accept Locale objects through locale-list processing, avoiding manual string surgery.” Apply this procedure: Use the complete Locale and inspect resolvedOptions. The expected mechanism is: The formatter resolves a supported locale and relevant preferences. For the mathematics app, add one near-miss that exposes extracting only language and discarding other preferences. 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 extracting only language and discarding other preferences.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Use the complete Locale and inspect resolvedOptions.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Pass Locale objects to Intl formatters?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing extracting only language and discarding other preferences be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny data import with canonicalising and validating stored locale tags. Include one ordinary case, one boundary and one deliberate failure caused by extracting only language and discarding other preferences. Predict each result before using a tool, then report the first point where observation differs from prediction.
Answer guide. A strong response starts with the rule: Intl constructors accept Locale objects through locale-list processing, avoiding manual string surgery. It shows a trace, not only a final value. The ordinary case should demonstrate “The formatter resolves a supported locale and relevant preferences.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use the complete Locale and inspect resolvedOptions. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Pass Locale objects to Intl formatters, separate the documented JavaScript Intl.Locale 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
Intl.Locale represents one locale; selecting the best supported application locale from a list remains negotiation. Treat that sentence as a testable model. A secure learner can point to the relevant input, name the operation, describe the resulting state and identify one observation that would prove the model incomplete.
The high-value mistake in this chapter is assuming every valid Locale is supported exactly by every catalogue. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Use supportedLocalesOf and define a fallback chain.
For the Locale negotiation is separate chapter on JavaScript Intl.Locale, use a two-column trace during a short Punggol home session. On the left, write the predicted state for this exact mechanism before the tool runs. On the right, record the observation that bears on assuming every valid Locale is supported exactly by every catalogue. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
console.log(Intl.NumberFormat.supportedLocalesOf(['en-SG','xx-YY']));Explained result. The result keeps only requested locales the runtime can support without fallback. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.
Four purposeful transfer cases
Case 1: reading interface. Stress-test the rule using choosing text direction and display 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 “Intl.Locale represents one locale; selecting the best supported application locale from a list remains negotiation.” Apply this procedure: Use supportedLocalesOf and define a fallback chain. The expected mechanism is: The result keeps only requested locales the runtime can support without fallback. For the reading interface, add one near-miss that exposes assuming every valid Locale is supported exactly by every catalogue. 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: mathematics app. Explain the rule using passing numbering-system preferences to formatters. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.
Reasoned route. Begin with “Intl.Locale represents one locale; selecting the best supported application locale from a list remains negotiation.” Apply this procedure: Use supportedLocalesOf and define a fallback chain. The expected mechanism is: The result keeps only requested locales the runtime can support without fallback. For the mathematics app, add one near-miss that exposes assuming every valid Locale is supported exactly by every catalogue. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Case 3: travel plan. Transfer the rule using separating language, script, region and time-zone choices. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.
Reasoned route. Begin with “Intl.Locale represents one locale; selecting the best supported application locale from a list remains negotiation.” Apply this procedure: Use supportedLocalesOf and define a fallback chain. The expected mechanism is: The result keeps only requested locales the runtime can support without fallback. For the travel plan, add one near-miss that exposes assuming every valid Locale is supported exactly by every catalogue. 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: data import. Predict the rule using canonicalising and validating stored locale tags. State the input grain or object graph, the chapter boundary and the intended output before choosing syntax. Change only one variable, so a wrong prediction has a single plausible cause.
Reasoned route. Begin with “Intl.Locale represents one locale; selecting the best supported application locale from a list remains negotiation.” Apply this procedure: Use supportedLocalesOf and define a fallback chain. The expected mechanism is: The result keeps only requested locales the runtime can support without fallback. For the data import, add one near-miss that exposes assuming every valid Locale is supported exactly by every catalogue. The answer is complete only when it says why the near-miss fails and how the corrected model transfers to a different project without relying on the original variable names.
Diagnostic route
- Model check: ask the learner to draw or list the exact rows, fields, references, paths or states involved.
- Boundary check: create the smallest input that triggers assuming every valid Locale is supported exactly by every catalogue.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Use supportedLocalesOf and define a 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Locale negotiation is separate?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing assuming every valid Locale is supported exactly by every catalogue be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny test laboratory with checking likely subtags, extensions, arrays and unsupported tags. Include one ordinary case, one boundary and one deliberate failure caused by assuming every valid Locale is supported exactly by every catalogue. Predict each result before using a tool, then report the first point where observation differs from prediction.
Answer guide. A strong response starts with the rule: Intl.Locale represents one locale; selecting the best supported application locale from a list remains negotiation. It shows a trace, not only a final value. The ordinary case should demonstrate “The result keeps only requested locales the runtime can support without fallback.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Use supportedLocalesOf and define a fallback chain. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Locale negotiation is separate, separate the documented JavaScript Intl.Locale 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
Structurally invalid language tags throw RangeError, making construction useful at an input boundary. 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 accepting arbitrary profile text as a locale. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Catch RangeError and preserve the original value for correction.
For the Invalid tags fail early chapter on JavaScript Intl.Locale, 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 accepting arbitrary profile text as a locale. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
try{ new Intl.Locale('not_a_locale'); }
catch(e){ console.log(e.name); }Explained result. The constructor reports RangeError for the invalid tag. Check the boundary as well as the happy path: ask what happens with an empty input, a duplicate or tied value, an unsupported type, a missing path, a NULL, or a second reference to the same object. Only the relevant boundary should be kept; the list is a prompt for judgment, not a demand to force every case into every example.
Four purposeful transfer cases
Case 1: travel plan. Explain the rule using separating language, script, region and time-zone choices. 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 “Structurally invalid language tags throw RangeError, making construction useful at an input boundary.” Apply this procedure: Catch RangeError and preserve the original value for correction. The expected mechanism is: The constructor reports RangeError for the invalid tag. For the travel plan, add one near-miss that exposes silently accepting arbitrary profile text as a 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: data import. Transfer the rule using canonicalising and validating stored locale tags. 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 “Structurally invalid language tags throw RangeError, making construction useful at an input boundary.” Apply this procedure: Catch RangeError and preserve the original value for correction. The expected mechanism is: The constructor reports RangeError for the invalid tag. For the data import, add one near-miss that exposes silently accepting arbitrary profile text as a 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: test laboratory. Predict the rule using checking likely subtags, extensions, arrays and unsupported tags. 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 “Structurally invalid language tags throw RangeError, making construction useful at an input boundary.” Apply this procedure: Catch RangeError and preserve the original value for correction. The expected mechanism is: The constructor reports RangeError for the invalid tag. For the test laboratory, add one near-miss that exposes silently accepting arbitrary profile text as a 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: design review. Contrast the rule using separating locale, translation, geography and identity. 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 “Structurally invalid language tags throw RangeError, making construction useful at an input boundary.” Apply this procedure: Catch RangeError and preserve the original value for correction. The expected mechanism is: The constructor reports RangeError for the invalid tag. For the design review, add one near-miss that exposes silently accepting arbitrary profile text as a 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 silently accepting arbitrary profile text as a locale.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Catch RangeError and preserve the original value for correction.” 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Invalid tags fail early?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing silently accepting arbitrary profile text as a locale be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny design review with separating locale, translation, geography and identity. Include one ordinary case, one boundary and one deliberate failure caused by silently accepting arbitrary profile text as a 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: Structurally invalid language tags throw RangeError, making construction useful at an input boundary. It shows a trace, not only a final value. The ordinary case should demonstrate “The constructor reports RangeError for the invalid tag.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Catch RangeError and preserve the original value for correction. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Invalid tags fail early, separate the documented JavaScript Intl.Locale 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
A locale can guide formatting and language selection but does not establish nationality, proficiency, address or translation. 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 one locale field for high-stakes assumptions. It matters because the output may look reasonable while the ownership, ordering, identity or safety rule is wrong. Store language, region, time zone and accessibility preferences separately.
For the Locale is metadata, not identity chapter on JavaScript Intl.Locale, 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 one locale field for high-stakes assumptions. Explain the earliest difference with one causal sentence, then repeat only the smallest changed case.
Core worked example
const profile={locale:'en-SG',timeZone:'Asia/Singapore',languages:['en','zh']};
console.log(profile);Explained result. Separate fields preserve distinct user choices rather than overloading one tag. 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: test laboratory. Transfer the rule using checking likely subtags, extensions, arrays and unsupported tags. 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 locale can guide formatting and language selection but does not establish nationality, proficiency, address or translation.” Apply this procedure: Store language, region, time zone and accessibility preferences separately. The expected mechanism is: Separate fields preserve distinct user choices rather than overloading one tag. For the test laboratory, add one near-miss that exposes using one locale field for high-stakes assumptions. 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: design review. Predict the rule using separating locale, translation, geography and identity. 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 locale can guide formatting and language selection but does not establish nationality, proficiency, address or translation.” Apply this procedure: Store language, region, time zone and accessibility preferences separately. The expected mechanism is: Separate fields preserve distinct user choices rather than overloading one tag. For the design review, add one near-miss that exposes using one locale field for high-stakes assumptions. 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 portal. Contrast the rule using carrying language and regional preferences across a Punggol household. 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 locale can guide formatting and language selection but does not establish nationality, proficiency, address or translation.” Apply this procedure: Store language, region, time zone and accessibility preferences separately. The expected mechanism is: Separate fields preserve distinct user choices rather than overloading one tag. For the family portal, add one near-miss that exposes using one locale field for high-stakes assumptions. 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 calendar. Stress-test the rule using reasoning about first day, weekend and regional conventions. 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 locale can guide formatting and language selection but does not establish nationality, proficiency, address or translation.” Apply this procedure: Store language, region, time zone and accessibility preferences separately. The expected mechanism is: Separate fields preserve distinct user choices rather than overloading one tag. For the school calendar, add one near-miss that exposes using one locale field for high-stakes assumptions. 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 one locale field for high-stakes assumptions.
- Evidence check: separate a printed value from identity, ordering, ownership, type or repository state.
- Repair check: use the reversible procedure “Store language, region, time zone and accessibility preferences 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.Locale syntax. For this chapter, useful prompts are: “What did you expect from Locale is metadata, not identity?”, “Which state changed first?”, “What evidence tests that prediction?”, and “Can the case exposing using one locale field for high-stakes assumptions be made smaller?” The learner, not the parent, should supply the technical explanation.
Practice with an explained answer
Question. Build a tiny family portal with carrying language and regional preferences across a Punggol household. Include one ordinary case, one boundary and one deliberate failure caused by using one locale field for high-stakes assumptions. 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 locale can guide formatting and language selection but does not establish nationality, proficiency, address or translation. It shows a trace, not only a final value. The ordinary case should demonstrate “Separate fields preserve distinct user choices rather than overloading one tag.” The boundary must exercise the same mechanism at an edge, and the deliberate failure must be repaired with: Store language, region, time zone and accessibility preferences separately. Other data choices are valid when the evidence supports the same causal chain.
Decision and transfer
For Locale is metadata, not identity, separate the documented JavaScript Intl.Locale 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 portal: model, boundary and recovery
Create a small family portal using carrying language and regional preferences across a Punggol household. Combine “Intl.Locale parses a locale identifier” 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: Construction validates and canonicalises a BCP 47 tag while retaining locale semantics for later Intl APIs. Apply: Construct one valid tag, print toString and inspect components. Verify: The canonical string is en-SG, with language en and region SG. 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 calendar: model, boundary and recovery
Create a small school calendar using reasoning about first day, weekend and regional conventions. Combine “Options can add or override fields” 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: Constructor options can set language, script, region and Unicode-related preferences to produce a new Locale. Apply: Construct a second Locale from the first plus options and compare strings. Verify: The original remains en and the new object is en-SG. 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. reading interface: model, boundary and recovery
Create a small reading interface using choosing text direction and display labels. Combine “numeric is a collation preference” 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 numeric option requests numeric-aware collation where a collator uses the locale; it does not parse numbers. Apply: Pass the locale to Intl.Collator and compare digit-containing labels. Verify: The negative result orders 2 before 10; the values remain strings. 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. mathematics app: model, boundary and recovery
Create a small mathematics app using passing numbering-system preferences to formatters. Combine “maximize and minimize do not mutate” 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: Both methods construct Locale objects and leave the source unchanged. Apply: Store the returned value and print both objects. Verify: The original can have undefined region while the maximized value has a likely region. 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. travel plan: model, boundary and recovery
Create a small travel plan using separating language, script, region and time-zone choices. Combine “getWeekInfo reports regional conventions” 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: Where implemented, getWeekInfo returns first day, weekend and minimal days from locale data. Apply: Query the locale and keep business rules separate from display defaults. Verify: A supporting runtime returns firstDay, weekend and minimalDays. 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. data import: model, boundary and recovery
Create a small data import using canonicalising and validating stored locale tags. Combine “Language alone may not yield time zones” 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: getTimeZones can return undefined without a region because time-zone lists are regional. Apply: Add a region explicitly and compare observations. Verify: The language-only result may be undefined while the regional locale supplies a list. 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. test laboratory: model, boundary and recovery
Create a small test laboratory using checking likely subtags, extensions, arrays and unsupported tags. Combine “Invalid tags fail early” 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: Structurally invalid language tags throw RangeError, making construction useful at an input boundary. Apply: Catch RangeError and preserve the original value for correction. Verify: The constructor reports RangeError for the invalid tag. 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. design review: model, boundary and recovery
Create a small design review using separating locale, translation, geography and identity. Combine “Language, script and region are different” 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: Language identifies a linguistic form, script a writing system and region regional conventions; none proves a user location. Apply: Label each subtag and the limited decision it may influence. Verify: The components are zh, Hans and SG; they are preference metadata, not a biography. 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.

