PUNGGOL TUITION · PRACTICAL MASTERY GUIDE
If a JavaScript service must emit a 21-digit identifier as a JSON number, converting the digits to Number can lose information before JSON.stringify begins. The useful question is where exact source text is validated, where it is preserved, and what the receiver will do with it.
JSON.rawJSON() validates a primitive JSON text and returns a frozen, null-prototype branded wrapper. JSON.stringify emits the stored primitive token directly. Objects and arrays, empty text, surrounding whitespace and invalid number spellings are rejected. This can preserve outbound digits, but an ordinary receiving JSON.parse may still round a large number, so the wire contract and consumer must be designed together.
This guide treats JavaScript JSON.rawJSON as a reasoning skill. It begins with the governing model, moves through worked examples and diagnostic routes, and ends with transfer cases, practice with explained answers, parent decisions and FAQs. The examples are proposed home or lesson activities; they are not claims about a physical Punggol branch, school affiliation, timetable, class size, fee or guaranteed result.
For a Punggol family, the practical aim is simple: a learner should be able to use a short study block before schoolwork, after CCA, or during a weekend library session without needing a large project. Each chapter is designed so the smallest useful example can be completed, discussed and saved as a test fixture.
The official technical reference for this article is ECMAScript JSON.rawJSON specification. Where the feature is version-sensitive or still developing, the article states that boundary explicitly. Examples were independently checked against the runtime or specification named in the reference section.
Choose a reading route
If the immediate concern is “I can copy the syntax but I cannot explain the result”, use the first route. If a real project is already failing, use the diagnostic route. Parents can use the final route to decide whether more practice, a smaller prerequisite or a different example is needed. For the wider learning framework, see How Studying Works.
Start from the model: Chapters 1–4. Begin with Create a raw JSON record and continue in order to Supply quotes for a JSON string.
Diagnose a confusing result: Chapters 5–8. Begin with Represent true false and null and continue in order to Reject surrounding whitespace.
Build reliable examples: Chapters 9–12. Begin with Reject leading-zero numbers and continue in order to Observe a frozen wrapper.
Transfer to real work: Chapters 13–16. Begin with Observe the null prototype and continue in order to Let stringify emit the raw token.
Decide and teach: Chapters 17–20. Begin with Nest raw primitives normally and continue in order to Feature-test and validate provenance.
Open the full 20-chapter index
- 1. Create a raw JSON record
- 2. Apply ToString before validation
- 3. Embed an exact JSON number
- 4. Supply quotes for a JSON string
- 5. Represent true false and null
- 6. Reject object and array text
- 7. Reject an empty fragment
- 8. Reject surrounding whitespace
- 9. Reject leading-zero numbers
- 10. Accept exponent notation
- 11. Preserve negative-zero spelling
- 12. Observe a frozen wrapper
- 13. Observe the null prototype
- 14. Read the exact rawJSON property
- 15. Use JSON.isRawJSON for branding
- 16. Let stringify emit the raw token
- 17. Nest raw primitives normally
- 18. Preserve outbound large-integer digits
- 19. Recognise receiver-side precision limits
- 20. Feature-test and validate provenance
CHAPTER 1 OF 20 · Back to contents
1. Create a raw JSON record
The short answer: Create a raw JSON record is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: JSON.rawJSON(text) validates primitive JSON text and returns a special raw-JSON object used by JSON.stringify.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “JSON.rawJSON(text) validates primitive JSON text and returns a special raw-JSON object used by JSON.stringify.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the create a raw json record example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const r=JSON.rawJSON('123');
console.log(r.rawJSON,JSON.isRawJSON(r));
Expected result and reasoning. Node.js 24.19.0 prints 123 and true. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Calling the result a parsed number misses that it is a branded wrapper carrying source text. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Is the observed value the primitive 123 or a raw-JSON record?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for create a raw json record
- Variable to hold constant: the surrounding setup, so the comparison isolates create a raw json record.
- Variable to change: compare typeof r with typeof JSON.parse(‘123’)
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For create a raw json record, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a large-number API response. Transfer create a raw json record into a large-number API response. Preserve the governing rule—JSON.rawJSON(text) validates primitive JSON text and returns a special raw-JSON object used by JSON.stringify.—while identifying what changes. Create a raw JSON record is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.rawJSON(text) validates primitive JSON text and returns a special raw-JSON object used by JSON.stringify.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a test harness. Transfer create a raw json record into a test harness. Preserve the governing rule—JSON.rawJSON(text) validates primitive JSON text and returns a special raw-JSON object used by JSON.stringify.—while identifying what changes. Create a raw JSON record is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.rawJSON(text) validates primitive JSON text and returns a special raw-JSON object used by JSON.stringify.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a nested payload. Transfer create a raw json record into a nested payload. Preserve the governing rule—JSON.rawJSON(text) validates primitive JSON text and returns a special raw-JSON object used by JSON.stringify.—while identifying what changes. Create a raw JSON record is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.rawJSON(text) validates primitive JSON text and returns a special raw-JSON object used by JSON.stringify.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a service boundary. Transfer create a raw json record into a service boundary. Preserve the governing rule—JSON.rawJSON(text) validates primitive JSON text and returns a special raw-JSON object used by JSON.stringify.—while identifying what changes. Create a raw JSON record is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.rawJSON(text) validates primitive JSON text and returns a special raw-JSON object used by JSON.stringify.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for create a raw json record, predict the result, then compare typeof r with typeof JSON.parse(‘123’). Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. Node.js 24.19.0 prints 123 and true. The contrast follows from this rule: JSON.rawJSON(text) validates primitive JSON text and returns a special raw-JSON object used by JSON.stringify. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for create a raw json record, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain create a raw json record, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Contents · Full contents · Next: Apply ToString before validation →
CHAPTER 2 OF 20 · Back to contents
2. Apply ToString before validation
The short answer: Apply ToString before validation is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: The argument is converted to a string before the resulting text is checked as JSON.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “The argument is converted to a string before the resulting text is checked as JSON.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the apply tostring before validation example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const r=JSON.rawJSON(123);
console.log(r.rawJSON);
Expected result and reasoning. The checked rawJSON property is the string 123. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Assuming only string arguments are accepted ignores the specified ToString step. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “What exact string reaches the JSON grammar?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for apply tostring before validation
- Variable to hold constant: the surrounding setup, so the comparison isolates apply tostring before validation.
- Variable to change: pass a custom object with a visible toString method
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For apply tostring before validation, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a ledger export. Transfer apply tostring before validation into a ledger export. Preserve the governing rule—The argument is converted to a string before the resulting text is checked as JSON.—while identifying what changes. Apply ToString before validation is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The argument is converted to a string before the resulting text is checked as JSON.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a compatibility check. Transfer apply tostring before validation into a compatibility check. Preserve the governing rule—The argument is converted to a string before the resulting text is checked as JSON.—while identifying what changes. Apply ToString before validation is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The argument is converted to a string before the resulting text is checked as JSON.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a data-validation lesson. Transfer apply tostring before validation into a data-validation lesson. Preserve the governing rule—The argument is converted to a string before the resulting text is checked as JSON.—while identifying what changes. Apply ToString before validation is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The argument is converted to a string before the resulting text is checked as JSON.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a regression suite. Transfer apply tostring before validation into a regression suite. Preserve the governing rule—The argument is converted to a string before the resulting text is checked as JSON.—while identifying what changes. Apply ToString before validation is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The argument is converted to a string before the resulting text is checked as JSON.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for apply tostring before validation, predict the result, then pass a custom object with a visible toString method. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The checked rawJSON property is the string 123. The contrast follows from this rule: The argument is converted to a string before the resulting text is checked as JSON. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for apply tostring before validation, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain apply tostring before validation, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Create a raw JSON record · Full contents · Next: Embed an exact JSON number →
CHAPTER 3 OF 20 · Back to contents
3. Embed an exact JSON number
The short answer: Embed an exact JSON number is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: A valid JSON number can be emitted verbatim by JSON.stringify when the raw record appears in the value graph.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “A valid JSON number can be emitted verbatim by JSON.stringify when the raw record appears in the value graph.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the embed an exact json number example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const r=JSON.rawJSON('12345678901234567890');
console.log(JSON.stringify({id:r}));
Expected result and reasoning. The output contains the exact twenty digits rather than first converting them to a JavaScript Number. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Writing the digits as a Number before rawJSON has already lost any unavailable precision. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Where did the original digit string come from and was it validated?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for embed an exact json number
- Variable to hold constant: the surrounding setup, so the comparison isolates embed an exact json number.
- Variable to change: compare with Number(‘12345678901234567890’)
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For embed an exact json number, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a test harness. Transfer embed an exact json number into a test harness. Preserve the governing rule—A valid JSON number can be emitted verbatim by JSON.stringify when the raw record appears in the value graph.—while identifying what changes. Embed an exact JSON number is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A valid JSON number can be emitted verbatim by JSON.stringify when the raw record appears in the value graph.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a nested payload. Transfer embed an exact json number into a nested payload. Preserve the governing rule—A valid JSON number can be emitted verbatim by JSON.stringify when the raw record appears in the value graph.—while identifying what changes. Embed an exact JSON number is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A valid JSON number can be emitted verbatim by JSON.stringify when the raw record appears in the value graph.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a service boundary. Transfer embed an exact json number into a service boundary. Preserve the governing rule—A valid JSON number can be emitted verbatim by JSON.stringify when the raw record appears in the value graph.—while identifying what changes. Embed an exact JSON number is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A valid JSON number can be emitted verbatim by JSON.stringify when the raw record appears in the value graph.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a large-number API response. Transfer embed an exact json number into a large-number API response. Preserve the governing rule—A valid JSON number can be emitted verbatim by JSON.stringify when the raw record appears in the value graph.—while identifying what changes. Embed an exact JSON number is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A valid JSON number can be emitted verbatim by JSON.stringify when the raw record appears in the value graph.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for embed an exact json number, predict the result, then compare with Number(‘12345678901234567890’). Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The output contains the exact twenty digits rather than first converting them to a JavaScript Number. The contrast follows from this rule: A valid JSON number can be emitted verbatim by JSON.stringify when the raw record appears in the value graph. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for embed an exact json number, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain embed an exact json number, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Apply ToString before validation · Full contents · Next: Supply quotes for a JSON string →
CHAPTER 4 OF 20 · Back to contents
4. Supply quotes for a JSON string
The short answer: Supply quotes for a JSON string is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: To represent a raw JSON string, the text itself must contain valid JSON quotation marks.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “To represent a raw JSON string, the text itself must contain valid JSON quotation marks.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the supply quotes for a json string example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const r=JSON.rawJSON('"hello"');
console.log(JSON.stringify({word:r}));
Expected result and reasoning. The output is {“word”:”hello”}. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Passing hello without JSON quotes is invalid JSON text and throws SyntaxError. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Is the raw fragment a JSON string literal or an unquoted JavaScript string?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for supply quotes for a json string
- Variable to hold constant: the surrounding setup, so the comparison isolates supply quotes for a json string.
- Variable to change: remove the inner quotes and observe validation
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For supply quotes for a json string, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a compatibility check. Transfer supply quotes for a json string into a compatibility check. Preserve the governing rule—To represent a raw JSON string, the text itself must contain valid JSON quotation marks.—while identifying what changes. Supply quotes for a JSON string is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “To represent a raw JSON string, the text itself must contain valid JSON quotation marks.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a data-validation lesson. Transfer supply quotes for a json string into a data-validation lesson. Preserve the governing rule—To represent a raw JSON string, the text itself must contain valid JSON quotation marks.—while identifying what changes. Supply quotes for a JSON string is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “To represent a raw JSON string, the text itself must contain valid JSON quotation marks.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a regression suite. Transfer supply quotes for a json string into a regression suite. Preserve the governing rule—To represent a raw JSON string, the text itself must contain valid JSON quotation marks.—while identifying what changes. Supply quotes for a JSON string is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “To represent a raw JSON string, the text itself must contain valid JSON quotation marks.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a ledger export. Transfer supply quotes for a json string into a ledger export. Preserve the governing rule—To represent a raw JSON string, the text itself must contain valid JSON quotation marks.—while identifying what changes. Supply quotes for a JSON string is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “To represent a raw JSON string, the text itself must contain valid JSON quotation marks.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for supply quotes for a json string, predict the result, then remove the inner quotes and observe validation. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The output is {“word”:”hello”}. The contrast follows from this rule: To represent a raw JSON string, the text itself must contain valid JSON quotation marks. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for supply quotes for a json string, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain supply quotes for a json string, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Embed an exact JSON number · Full contents · Next: Represent true false and null →
CHAPTER 5 OF 20 · Back to contents
5. Represent true false and null
The short answer: Represent true false and null is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: The primitive JSON texts true, false and null are valid raw fragments.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “The primitive JSON texts true, false and null are valid raw fragments.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the represent true false and null example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
for(const s of ['true','false','null']) console.log(JSON.stringify([JSON.rawJSON(s)]));
Expected result and reasoning. The verified outputs contain the corresponding primitive tokens. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Passing undefined is not equivalent to JSON null; ToString(undefined) produces invalid JSON text. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Which JSON primitive grammar should match?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for represent true false and null
- Variable to hold constant: the surrounding setup, so the comparison isolates represent true false and null.
- Variable to change: try undefined and record the SyntaxError
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For represent true false and null, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a nested payload. Transfer represent true false and null into a nested payload. Preserve the governing rule—The primitive JSON texts true, false and null are valid raw fragments.—while identifying what changes. Represent true false and null is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The primitive JSON texts true, false and null are valid raw fragments.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a service boundary. Transfer represent true false and null into a service boundary. Preserve the governing rule—The primitive JSON texts true, false and null are valid raw fragments.—while identifying what changes. Represent true false and null is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The primitive JSON texts true, false and null are valid raw fragments.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a large-number API response. Transfer represent true false and null into a large-number API response. Preserve the governing rule—The primitive JSON texts true, false and null are valid raw fragments.—while identifying what changes. Represent true false and null is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The primitive JSON texts true, false and null are valid raw fragments.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a test harness. Transfer represent true false and null into a test harness. Preserve the governing rule—The primitive JSON texts true, false and null are valid raw fragments.—while identifying what changes. Represent true false and null is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The primitive JSON texts true, false and null are valid raw fragments.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for represent true false and null, predict the result, then try undefined and record the SyntaxError. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The verified outputs contain the corresponding primitive tokens. The contrast follows from this rule: The primitive JSON texts true, false and null are valid raw fragments. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for represent true false and null, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain represent true false and null, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Supply quotes for a JSON string · Full contents · Next: Reject object and array text →
CHAPTER 6 OF 20 · Back to contents
6. Reject object and array text
The short answer: Reject object and array text is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: JSON.rawJSON deliberately excludes JSON object and array fragments even when they are otherwise valid JSON.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “JSON.rawJSON deliberately excludes JSON object and array fragments even when they are otherwise valid JSON.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the reject object and array text example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
for(const s of ['{}','[1,2]']){try{JSON.rawJSON(s)}catch(e){console.log(e.name)}}
Expected result and reasoning. Node.js 24.19.0 reports SyntaxError for both. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Treating rawJSON as a general raw-fragment injection API overstates its scope. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Is the top-level fragment primitive, object or array?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for reject object and array text
- Variable to hold constant: the surrounding setup, so the comparison isolates reject object and array text.
- Variable to change: wrap separate raw primitive values inside an ordinary JavaScript object
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For reject object and array text, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a data-validation lesson. Transfer reject object and array text into a data-validation lesson. Preserve the governing rule—JSON.rawJSON deliberately excludes JSON object and array fragments even when they are otherwise valid JSON.—while identifying what changes. Reject object and array text is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.rawJSON deliberately excludes JSON object and array fragments even when they are otherwise valid JSON.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a regression suite. Transfer reject object and array text into a regression suite. Preserve the governing rule—JSON.rawJSON deliberately excludes JSON object and array fragments even when they are otherwise valid JSON.—while identifying what changes. Reject object and array text is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.rawJSON deliberately excludes JSON object and array fragments even when they are otherwise valid JSON.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a ledger export. Transfer reject object and array text into a ledger export. Preserve the governing rule—JSON.rawJSON deliberately excludes JSON object and array fragments even when they are otherwise valid JSON.—while identifying what changes. Reject object and array text is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.rawJSON deliberately excludes JSON object and array fragments even when they are otherwise valid JSON.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a compatibility check. Transfer reject object and array text into a compatibility check. Preserve the governing rule—JSON.rawJSON deliberately excludes JSON object and array fragments even when they are otherwise valid JSON.—while identifying what changes. Reject object and array text is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.rawJSON deliberately excludes JSON object and array fragments even when they are otherwise valid JSON.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for reject object and array text, predict the result, then wrap separate raw primitive values inside an ordinary JavaScript object. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. Node.js 24.19.0 reports SyntaxError for both. The contrast follows from this rule: JSON.rawJSON deliberately excludes JSON object and array fragments even when they are otherwise valid JSON. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for reject object and array text, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain reject object and array text, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Represent true false and null · Full contents · Next: Reject an empty fragment →
CHAPTER 7 OF 20 · Back to contents
7. Reject an empty fragment
The short answer: Reject an empty fragment is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: An empty string is not a complete JSON primitive and fails validation.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “An empty string is not a complete JSON primitive and fails validation.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the reject an empty fragment example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
try{JSON.rawJSON('')}catch(e){console.log(e.name)}
Expected result and reasoning. The verified error name is SyntaxError. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Calling empty text the same as JSON null hides a meaningful data distinction. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “What complete JSON token is present?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for reject an empty fragment
- Variable to hold constant: the surrounding setup, so the comparison isolates reject an empty fragment.
- Variable to change: replace the empty text with null
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For reject an empty fragment, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a service boundary. Transfer reject an empty fragment into a service boundary. Preserve the governing rule—An empty string is not a complete JSON primitive and fails validation.—while identifying what changes. Reject an empty fragment is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “An empty string is not a complete JSON primitive and fails validation.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a large-number API response. Transfer reject an empty fragment into a large-number API response. Preserve the governing rule—An empty string is not a complete JSON primitive and fails validation.—while identifying what changes. Reject an empty fragment is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “An empty string is not a complete JSON primitive and fails validation.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a test harness. Transfer reject an empty fragment into a test harness. Preserve the governing rule—An empty string is not a complete JSON primitive and fails validation.—while identifying what changes. Reject an empty fragment is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “An empty string is not a complete JSON primitive and fails validation.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a nested payload. Transfer reject an empty fragment into a nested payload. Preserve the governing rule—An empty string is not a complete JSON primitive and fails validation.—while identifying what changes. Reject an empty fragment is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “An empty string is not a complete JSON primitive and fails validation.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for reject an empty fragment, predict the result, then replace the empty text with null. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The verified error name is SyntaxError. The contrast follows from this rule: An empty string is not a complete JSON primitive and fails validation. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for reject an empty fragment, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain reject an empty fragment, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Reject object and array text · Full contents · Next: Reject surrounding whitespace →
CHAPTER 8 OF 20 · Back to contents
8. Reject surrounding whitespace
The short answer: Reject surrounding whitespace is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: The raw text may not start or end with JSON whitespace under the JSON.rawJSON validation algorithm.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “The raw text may not start or end with JSON whitespace under the JSON.rawJSON validation algorithm.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the reject surrounding whitespace example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
for(const s of [' 1','1 ','\ntrue']){try{JSON.rawJSON(s)}catch(e){console.log(e.name)}}
Expected result and reasoning. Each checked input throws SyntaxError. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Trimming silently inside a helper can conceal upstream formatting and validation mistakes. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Do the first and final code points belong to the primitive token?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for reject surrounding whitespace
- Variable to hold constant: the surrounding setup, so the comparison isolates reject surrounding whitespace.
- Variable to change: trim explicitly, record that policy, and validate again
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For reject surrounding whitespace, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a regression suite. Transfer reject surrounding whitespace into a regression suite. Preserve the governing rule—The raw text may not start or end with JSON whitespace under the JSON.rawJSON validation algorithm.—while identifying what changes. Reject surrounding whitespace is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The raw text may not start or end with JSON whitespace under the JSON.rawJSON validation algorithm.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a ledger export. Transfer reject surrounding whitespace into a ledger export. Preserve the governing rule—The raw text may not start or end with JSON whitespace under the JSON.rawJSON validation algorithm.—while identifying what changes. Reject surrounding whitespace is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The raw text may not start or end with JSON whitespace under the JSON.rawJSON validation algorithm.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a compatibility check. Transfer reject surrounding whitespace into a compatibility check. Preserve the governing rule—The raw text may not start or end with JSON whitespace under the JSON.rawJSON validation algorithm.—while identifying what changes. Reject surrounding whitespace is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The raw text may not start or end with JSON whitespace under the JSON.rawJSON validation algorithm.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a data-validation lesson. Transfer reject surrounding whitespace into a data-validation lesson. Preserve the governing rule—The raw text may not start or end with JSON whitespace under the JSON.rawJSON validation algorithm.—while identifying what changes. Reject surrounding whitespace is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The raw text may not start or end with JSON whitespace under the JSON.rawJSON validation algorithm.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for reject surrounding whitespace, predict the result, then trim explicitly, record that policy, and validate again. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. Each checked input throws SyntaxError. The contrast follows from this rule: The raw text may not start or end with JSON whitespace under the JSON.rawJSON validation algorithm. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for reject surrounding whitespace, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain reject surrounding whitespace, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Reject an empty fragment · Full contents · Next: Reject leading-zero numbers →
CHAPTER 9 OF 20 · Back to contents
9. Reject leading-zero numbers
The short answer: Reject leading-zero numbers is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: JSON number grammar does not permit a leading zero before another integer digit.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “JSON number grammar does not permit a leading zero before another integer digit.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the reject leading-zero numbers example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
try{JSON.rawJSON('01')}catch(e){console.log(e.name)}
Expected result and reasoning. The checked input throws SyntaxError. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Assuming JavaScript numeric literal habits define JSON grammar produces invalid wire data. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Does the source text match JSON number grammar exactly?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for reject leading-zero numbers
- Variable to hold constant: the surrounding setup, so the comparison isolates reject leading-zero numbers.
- Variable to change: compare 01 with 1 and 0.1
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For reject leading-zero numbers, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a large-number API response. Transfer reject leading-zero numbers into a large-number API response. Preserve the governing rule—JSON number grammar does not permit a leading zero before another integer digit.—while identifying what changes. Reject leading-zero numbers is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON number grammar does not permit a leading zero before another integer digit.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a test harness. Transfer reject leading-zero numbers into a test harness. Preserve the governing rule—JSON number grammar does not permit a leading zero before another integer digit.—while identifying what changes. Reject leading-zero numbers is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON number grammar does not permit a leading zero before another integer digit.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a nested payload. Transfer reject leading-zero numbers into a nested payload. Preserve the governing rule—JSON number grammar does not permit a leading zero before another integer digit.—while identifying what changes. Reject leading-zero numbers is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON number grammar does not permit a leading zero before another integer digit.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a service boundary. Transfer reject leading-zero numbers into a service boundary. Preserve the governing rule—JSON number grammar does not permit a leading zero before another integer digit.—while identifying what changes. Reject leading-zero numbers is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON number grammar does not permit a leading zero before another integer digit.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for reject leading-zero numbers, predict the result, then compare 01 with 1 and 0.1. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The checked input throws SyntaxError. The contrast follows from this rule: JSON number grammar does not permit a leading zero before another integer digit. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for reject leading-zero numbers, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain reject leading-zero numbers, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Reject surrounding whitespace · Full contents · Next: Accept exponent notation →
CHAPTER 10 OF 20 · Back to contents
10. Accept exponent notation
The short answer: Accept exponent notation is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: A syntactically valid JSON number using exponent notation can be preserved as raw text.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “A syntactically valid JSON number using exponent notation can be preserved as raw text.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the accept exponent notation example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const r=JSON.rawJSON('1e3');
console.log(JSON.stringify({n:r}));
Expected result and reasoning. The verified output preserves 1e3 rather than normalising it to 1000. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Assuming stringify always canonicalises raw numeric spelling ignores the purpose of the wrapper. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Is exact spelling or only numeric meaning important downstream?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for accept exponent notation
- Variable to hold constant: the surrounding setup, so the comparison isolates accept exponent notation.
- Variable to change: compare the raw wrapper with the Number value 1e3
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For accept exponent notation, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a ledger export. Transfer accept exponent notation into a ledger export. Preserve the governing rule—A syntactically valid JSON number using exponent notation can be preserved as raw text.—while identifying what changes. Accept exponent notation is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A syntactically valid JSON number using exponent notation can be preserved as raw text.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a compatibility check. Transfer accept exponent notation into a compatibility check. Preserve the governing rule—A syntactically valid JSON number using exponent notation can be preserved as raw text.—while identifying what changes. Accept exponent notation is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A syntactically valid JSON number using exponent notation can be preserved as raw text.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a data-validation lesson. Transfer accept exponent notation into a data-validation lesson. Preserve the governing rule—A syntactically valid JSON number using exponent notation can be preserved as raw text.—while identifying what changes. Accept exponent notation is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A syntactically valid JSON number using exponent notation can be preserved as raw text.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a regression suite. Transfer accept exponent notation into a regression suite. Preserve the governing rule—A syntactically valid JSON number using exponent notation can be preserved as raw text.—while identifying what changes. Accept exponent notation is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A syntactically valid JSON number using exponent notation can be preserved as raw text.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for accept exponent notation, predict the result, then compare the raw wrapper with the Number value 1e3. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The verified output preserves 1e3 rather than normalising it to 1000. The contrast follows from this rule: A syntactically valid JSON number using exponent notation can be preserved as raw text. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for accept exponent notation, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain accept exponent notation, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Reject leading-zero numbers · Full contents · Next: Preserve negative-zero spelling →
CHAPTER 11 OF 20 · Back to contents
11. Preserve negative-zero spelling
The short answer: Preserve negative-zero spelling is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: The valid JSON number text -0 can be emitted exactly through a raw record.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “The valid JSON number text -0 can be emitted exactly through a raw record.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the preserve negative-zero spelling example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
console.log(JSON.stringify({n:JSON.rawJSON('-0')}));
Expected result and reasoning. The checked output contains “n”:-0. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Ordinary JSON.stringify(-0) produces 0, so the paths are observably different. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Was -0 supplied as text before any Number conversion?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for preserve negative-zero spelling
- Variable to hold constant: the surrounding setup, so the comparison isolates preserve negative-zero spelling.
- Variable to change: compare JSON.stringify(-0) with the raw form
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For preserve negative-zero spelling, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a test harness. Transfer preserve negative-zero spelling into a test harness. Preserve the governing rule—The valid JSON number text -0 can be emitted exactly through a raw record.—while identifying what changes. Preserve negative-zero spelling is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The valid JSON number text -0 can be emitted exactly through a raw record.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a nested payload. Transfer preserve negative-zero spelling into a nested payload. Preserve the governing rule—The valid JSON number text -0 can be emitted exactly through a raw record.—while identifying what changes. Preserve negative-zero spelling is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The valid JSON number text -0 can be emitted exactly through a raw record.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a service boundary. Transfer preserve negative-zero spelling into a service boundary. Preserve the governing rule—The valid JSON number text -0 can be emitted exactly through a raw record.—while identifying what changes. Preserve negative-zero spelling is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The valid JSON number text -0 can be emitted exactly through a raw record.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a large-number API response. Transfer preserve negative-zero spelling into a large-number API response. Preserve the governing rule—The valid JSON number text -0 can be emitted exactly through a raw record.—while identifying what changes. Preserve negative-zero spelling is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The valid JSON number text -0 can be emitted exactly through a raw record.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for preserve negative-zero spelling, predict the result, then compare JSON.stringify(-0) with the raw form. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The checked output contains “n”:-0. The contrast follows from this rule: The valid JSON number text -0 can be emitted exactly through a raw record. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for preserve negative-zero spelling, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain preserve negative-zero spelling, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Accept exponent notation · Full contents · Next: Observe a frozen wrapper →
CHAPTER 12 OF 20 · Back to contents
12. Observe a frozen wrapper
The short answer: Observe a frozen wrapper is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: The returned raw-JSON object is frozen and cannot be extended or have its data property changed.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “The returned raw-JSON object is frozen and cannot be extended or have its data property changed.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the observe a frozen wrapper example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const r=JSON.rawJSON('7');
console.log(Object.isFrozen(r));
Expected result and reasoning. Node.js 24.19.0 prints true. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Trying to repair an invalid or outdated fragment by mutating the wrapper cannot succeed. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Must a changed fragment be validated into a new wrapper?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for observe a frozen wrapper
- Variable to hold constant: the surrounding setup, so the comparison isolates observe a frozen wrapper.
- Variable to change: attempt an assignment in strict mode and create a new record instead
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For observe a frozen wrapper, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a compatibility check. Transfer observe a frozen wrapper into a compatibility check. Preserve the governing rule—The returned raw-JSON object is frozen and cannot be extended or have its data property changed.—while identifying what changes. Observe a frozen wrapper is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The returned raw-JSON object is frozen and cannot be extended or have its data property changed.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a data-validation lesson. Transfer observe a frozen wrapper into a data-validation lesson. Preserve the governing rule—The returned raw-JSON object is frozen and cannot be extended or have its data property changed.—while identifying what changes. Observe a frozen wrapper is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The returned raw-JSON object is frozen and cannot be extended or have its data property changed.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a regression suite. Transfer observe a frozen wrapper into a regression suite. Preserve the governing rule—The returned raw-JSON object is frozen and cannot be extended or have its data property changed.—while identifying what changes. Observe a frozen wrapper is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The returned raw-JSON object is frozen and cannot be extended or have its data property changed.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a ledger export. Transfer observe a frozen wrapper into a ledger export. Preserve the governing rule—The returned raw-JSON object is frozen and cannot be extended or have its data property changed.—while identifying what changes. Observe a frozen wrapper is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The returned raw-JSON object is frozen and cannot be extended or have its data property changed.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for observe a frozen wrapper, predict the result, then attempt an assignment in strict mode and create a new record instead. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. Node.js 24.19.0 prints true. The contrast follows from this rule: The returned raw-JSON object is frozen and cannot be extended or have its data property changed. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for observe a frozen wrapper, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain observe a frozen wrapper, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Preserve negative-zero spelling · Full contents · Next: Observe the null prototype →
CHAPTER 13 OF 20 · Back to contents
13. Observe the null prototype
The short answer: Observe the null prototype is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: A raw-JSON object is created with a null prototype.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “A raw-JSON object is created with a null prototype.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the observe the null prototype example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const r=JSON.rawJSON('7');
console.log(Object.getPrototypeOf(r)===null);
Expected result and reasoning. The verified Boolean is true. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Expecting inherited Object methods directly on the wrapper is unreliable. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Which operations depend on Object.prototype inheritance?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for observe the null prototype
- Variable to hold constant: the surrounding setup, so the comparison isolates observe the null prototype.
- Variable to change: call Object.prototype.hasOwnProperty.call explicitly
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For observe the null prototype, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a nested payload. Transfer observe the null prototype into a nested payload. Preserve the governing rule—A raw-JSON object is created with a null prototype.—while identifying what changes. Observe the null prototype is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A raw-JSON object is created with a null prototype.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a service boundary. Transfer observe the null prototype into a service boundary. Preserve the governing rule—A raw-JSON object is created with a null prototype.—while identifying what changes. Observe the null prototype is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A raw-JSON object is created with a null prototype.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a large-number API response. Transfer observe the null prototype into a large-number API response. Preserve the governing rule—A raw-JSON object is created with a null prototype.—while identifying what changes. Observe the null prototype is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A raw-JSON object is created with a null prototype.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a test harness. Transfer observe the null prototype into a test harness. Preserve the governing rule—A raw-JSON object is created with a null prototype.—while identifying what changes. Observe the null prototype is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A raw-JSON object is created with a null prototype.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for observe the null prototype, predict the result, then call Object.prototype.hasOwnProperty.call explicitly. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The verified Boolean is true. The contrast follows from this rule: A raw-JSON object is created with a null prototype. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for observe the null prototype, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain observe the null prototype, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Observe a frozen wrapper · Full contents · Next: Read the exact rawJSON property →
CHAPTER 14 OF 20 · Back to contents
14. Read the exact rawJSON property
The short answer: Read the exact rawJSON property is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: The wrapper exposes an own rawJSON data property containing the validated source text.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “The wrapper exposes an own rawJSON data property containing the validated source text.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the read the exact rawjson property example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const r=JSON.rawJSON('1e3');
console.log(Object.keys(r),r.rawJSON);
Expected result and reasoning. The checked output shows the rawJSON key and exact text 1e3. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Treating the property as a computed numeric result loses the distinction between source text and parsed value. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Is the property text or a JavaScript primitive interpretation?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for read the exact rawjson property
- Variable to hold constant: the surrounding setup, so the comparison isolates read the exact rawjson property.
- Variable to change: compare r.rawJSON with JSON.parse(r.rawJSON)
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For read the exact rawjson property, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a data-validation lesson. Transfer read the exact rawjson property into a data-validation lesson. Preserve the governing rule—The wrapper exposes an own rawJSON data property containing the validated source text.—while identifying what changes. Read the exact rawJSON property is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The wrapper exposes an own rawJSON data property containing the validated source text.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a regression suite. Transfer read the exact rawjson property into a regression suite. Preserve the governing rule—The wrapper exposes an own rawJSON data property containing the validated source text.—while identifying what changes. Read the exact rawJSON property is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The wrapper exposes an own rawJSON data property containing the validated source text.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a ledger export. Transfer read the exact rawjson property into a ledger export. Preserve the governing rule—The wrapper exposes an own rawJSON data property containing the validated source text.—while identifying what changes. Read the exact rawJSON property is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The wrapper exposes an own rawJSON data property containing the validated source text.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a compatibility check. Transfer read the exact rawjson property into a compatibility check. Preserve the governing rule—The wrapper exposes an own rawJSON data property containing the validated source text.—while identifying what changes. Read the exact rawJSON property is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The wrapper exposes an own rawJSON data property containing the validated source text.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for read the exact rawjson property, predict the result, then compare r.rawJSON with JSON.parse(r.rawJSON). Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The checked output shows the rawJSON key and exact text 1e3. The contrast follows from this rule: The wrapper exposes an own rawJSON data property containing the validated source text. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for read the exact rawjson property, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain read the exact rawjson property, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Observe the null prototype · Full contents · Next: Use JSON.isRawJSON for branding →
CHAPTER 15 OF 20 · Back to contents
15. Use JSON.isRawJSON for branding
The short answer: Use JSON.isRawJSON for branding is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: JSON.isRawJSON returns true only for authentic raw-JSON objects, not lookalike ordinary objects.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “JSON.isRawJSON returns true only for authentic raw-JSON objects, not lookalike ordinary objects.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the use json.israwjson for branding example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const real=JSON.rawJSON('1');
const fake={rawJSON:'1'};
console.log(JSON.isRawJSON(real),JSON.isRawJSON(fake));
Expected result and reasoning. The verified result is true false. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Checking only for a rawJSON property permits an unbranded imitation. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Was the value produced by the built-in and branded internally?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for use json.israwjson for branding
- Variable to hold constant: the surrounding setup, so the comparison isolates use json.israwjson for branding.
- Variable to change: compare a spread copy of the real wrapper
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For use json.israwjson for branding, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a service boundary. Transfer use json.israwjson for branding into a service boundary. Preserve the governing rule—JSON.isRawJSON returns true only for authentic raw-JSON objects, not lookalike ordinary objects.—while identifying what changes. Use JSON.isRawJSON for branding is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.isRawJSON returns true only for authentic raw-JSON objects, not lookalike ordinary objects.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a large-number API response. Transfer use json.israwjson for branding into a large-number API response. Preserve the governing rule—JSON.isRawJSON returns true only for authentic raw-JSON objects, not lookalike ordinary objects.—while identifying what changes. Use JSON.isRawJSON for branding is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.isRawJSON returns true only for authentic raw-JSON objects, not lookalike ordinary objects.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a test harness. Transfer use json.israwjson for branding into a test harness. Preserve the governing rule—JSON.isRawJSON returns true only for authentic raw-JSON objects, not lookalike ordinary objects.—while identifying what changes. Use JSON.isRawJSON for branding is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.isRawJSON returns true only for authentic raw-JSON objects, not lookalike ordinary objects.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a nested payload. Transfer use json.israwjson for branding into a nested payload. Preserve the governing rule—JSON.isRawJSON returns true only for authentic raw-JSON objects, not lookalike ordinary objects.—while identifying what changes. Use JSON.isRawJSON for branding is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “JSON.isRawJSON returns true only for authentic raw-JSON objects, not lookalike ordinary objects.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for use json.israwjson for branding, predict the result, then compare a spread copy of the real wrapper. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The verified result is true false. The contrast follows from this rule: JSON.isRawJSON returns true only for authentic raw-JSON objects, not lookalike ordinary objects. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for use json.israwjson for branding, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain use json.israwjson for branding, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Read the exact rawJSON property · Full contents · Next: Let stringify emit the raw token →
CHAPTER 16 OF 20 · Back to contents
16. Let stringify emit the raw token
The short answer: Let stringify emit the raw token is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: During JSON serialization, a raw-JSON value contributes its stored text directly instead of serializing the wrapper as an ordinary object.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “During JSON serialization, a raw-JSON value contributes its stored text directly instead of serializing the wrapper as an ordinary object.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the let stringify emit the raw token example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const value={answer:JSON.rawJSON('42')};
console.log(JSON.stringify(value));
Expected result and reasoning. The output is {“answer”:42}, not an object with a rawJSON field. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Inspecting the wrapper alone does not show its special stringify behaviour. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “What position does the raw record occupy in the serialized value graph?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for let stringify emit the raw token
- Variable to hold constant: the surrounding setup, so the comparison isolates let stringify emit the raw token.
- Variable to change: replace it with {rawJSON:’42’} and compare
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For let stringify emit the raw token, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a regression suite. Transfer let stringify emit the raw token into a regression suite. Preserve the governing rule—During JSON serialization, a raw-JSON value contributes its stored text directly instead of serializing the wrapper as an ordinary object.—while identifying what changes. Let stringify emit the raw token is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “During JSON serialization, a raw-JSON value contributes its stored text directly instead of serializing the wrapper as an ordinary object.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a ledger export. Transfer let stringify emit the raw token into a ledger export. Preserve the governing rule—During JSON serialization, a raw-JSON value contributes its stored text directly instead of serializing the wrapper as an ordinary object.—while identifying what changes. Let stringify emit the raw token is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “During JSON serialization, a raw-JSON value contributes its stored text directly instead of serializing the wrapper as an ordinary object.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a compatibility check. Transfer let stringify emit the raw token into a compatibility check. Preserve the governing rule—During JSON serialization, a raw-JSON value contributes its stored text directly instead of serializing the wrapper as an ordinary object.—while identifying what changes. Let stringify emit the raw token is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “During JSON serialization, a raw-JSON value contributes its stored text directly instead of serializing the wrapper as an ordinary object.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a data-validation lesson. Transfer let stringify emit the raw token into a data-validation lesson. Preserve the governing rule—During JSON serialization, a raw-JSON value contributes its stored text directly instead of serializing the wrapper as an ordinary object.—while identifying what changes. Let stringify emit the raw token is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “During JSON serialization, a raw-JSON value contributes its stored text directly instead of serializing the wrapper as an ordinary object.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for let stringify emit the raw token, predict the result, then replace it with {rawJSON:’42’} and compare. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The output is {“answer”:42}, not an object with a rawJSON field. The contrast follows from this rule: During JSON serialization, a raw-JSON value contributes its stored text directly instead of serializing the wrapper as an ordinary object. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for let stringify emit the raw token, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain let stringify emit the raw token, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Use JSON.isRawJSON for branding · Full contents · Next: Nest raw primitives normally →
CHAPTER 17 OF 20 · Back to contents
17. Nest raw primitives normally
The short answer: Nest raw primitives normally is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: Raw-JSON records can appear as property values or array elements inside ordinary JavaScript objects and arrays.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “Raw-JSON records can appear as property values or array elements inside ordinary JavaScript objects and arrays.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the nest raw primitives normally example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const x={items:[JSON.rawJSON('2'),JSON.rawJSON('false')]};
console.log(JSON.stringify(x));
Expected result and reasoning. The output contains [2,false] as primitive JSON values. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Using raw object or array fragments is unnecessary; ordinary containers already provide safe structure. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Which layer should own the container punctuation?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for nest raw primitives normally
- Variable to hold constant: the surrounding setup, so the comparison isolates nest raw primitives normally.
- Variable to change: move the wrappers between an object property and an array
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For nest raw primitives normally, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a large-number API response. Transfer nest raw primitives normally into a large-number API response. Preserve the governing rule—Raw-JSON records can appear as property values or array elements inside ordinary JavaScript objects and arrays.—while identifying what changes. Nest raw primitives normally is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “Raw-JSON records can appear as property values or array elements inside ordinary JavaScript objects and arrays.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a test harness. Transfer nest raw primitives normally into a test harness. Preserve the governing rule—Raw-JSON records can appear as property values or array elements inside ordinary JavaScript objects and arrays.—while identifying what changes. Nest raw primitives normally is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “Raw-JSON records can appear as property values or array elements inside ordinary JavaScript objects and arrays.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a nested payload. Transfer nest raw primitives normally into a nested payload. Preserve the governing rule—Raw-JSON records can appear as property values or array elements inside ordinary JavaScript objects and arrays.—while identifying what changes. Nest raw primitives normally is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “Raw-JSON records can appear as property values or array elements inside ordinary JavaScript objects and arrays.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a service boundary. Transfer nest raw primitives normally into a service boundary. Preserve the governing rule—Raw-JSON records can appear as property values or array elements inside ordinary JavaScript objects and arrays.—while identifying what changes. Nest raw primitives normally is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “Raw-JSON records can appear as property values or array elements inside ordinary JavaScript objects and arrays.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for nest raw primitives normally, predict the result, then move the wrappers between an object property and an array. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The output contains [2,false] as primitive JSON values. The contrast follows from this rule: Raw-JSON records can appear as property values or array elements inside ordinary JavaScript objects and arrays. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for nest raw primitives normally, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain nest raw primitives normally, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Let stringify emit the raw token · Full contents · Next: Preserve outbound large-integer digits →
CHAPTER 18 OF 20 · Back to contents
18. Preserve outbound large-integer digits
The short answer: Preserve outbound large-integer digits is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: The main precision use case is preserving trusted, validated integer digits on output without first coercing them to Number.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “The main precision use case is preserving trusted, validated integer digits on output without first coercing them to Number.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the preserve outbound large-integer digits example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const digits='900719925474099312345';
const out=JSON.stringify({id:JSON.rawJSON(digits)});
console.log(out.includes(digits));
Expected result and reasoning. The checked output still contains every source digit, so the inclusion test is true. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Calling Number(digits) before wrapping defeats this purpose because precision can already be lost. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Where is the earliest point at which digits become a Number?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for preserve outbound large-integer digits
- Variable to hold constant: the surrounding setup, so the comparison isolates preserve outbound large-integer digits.
- Variable to change: keep the value as text from validation through serialization
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For preserve outbound large-integer digits, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a ledger export. Transfer preserve outbound large-integer digits into a ledger export. Preserve the governing rule—The main precision use case is preserving trusted, validated integer digits on output without first coercing them to Number.—while identifying what changes. Preserve outbound large-integer digits is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The main precision use case is preserving trusted, validated integer digits on output without first coercing them to Number.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a compatibility check. Transfer preserve outbound large-integer digits into a compatibility check. Preserve the governing rule—The main precision use case is preserving trusted, validated integer digits on output without first coercing them to Number.—while identifying what changes. Preserve outbound large-integer digits is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The main precision use case is preserving trusted, validated integer digits on output without first coercing them to Number.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a data-validation lesson. Transfer preserve outbound large-integer digits into a data-validation lesson. Preserve the governing rule—The main precision use case is preserving trusted, validated integer digits on output without first coercing them to Number.—while identifying what changes. Preserve outbound large-integer digits is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The main precision use case is preserving trusted, validated integer digits on output without first coercing them to Number.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a regression suite. Transfer preserve outbound large-integer digits into a regression suite. Preserve the governing rule—The main precision use case is preserving trusted, validated integer digits on output without first coercing them to Number.—while identifying what changes. Preserve outbound large-integer digits is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “The main precision use case is preserving trusted, validated integer digits on output without first coercing them to Number.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for preserve outbound large-integer digits, predict the result, then keep the value as text from validation through serialization. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The checked output still contains every source digit, so the inclusion test is true. The contrast follows from this rule: The main precision use case is preserving trusted, validated integer digits on output without first coercing them to Number. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for preserve outbound large-integer digits, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain preserve outbound large-integer digits, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Nest raw primitives normally · Full contents · Next: Recognise receiver-side precision limits →
CHAPTER 19 OF 20 · Back to contents
19. Recognise receiver-side precision limits
The short answer: Recognise receiver-side precision limits is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: A receiving JavaScript program that uses JSON.parse normally still converts a JSON number to Number and may lose precision.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “A receiving JavaScript program that uses JSON.parse normally still converts a JSON number to Number and may lose precision.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the recognise receiver-side precision limits example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
const s=JSON.stringify({id:JSON.rawJSON('900719925474099312345')});
console.log(JSON.parse(s).id);
Expected result and reasoning. The receiver displays a rounded Number on the checked runtime despite exact outbound digits. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. Claiming rawJSON solves end-to-end precision ignores the consumer’s parser and data model. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “How will every receiver represent the numeric token?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for recognise receiver-side precision limits
- Variable to hold constant: the surrounding setup, so the comparison isolates recognise receiver-side precision limits.
- Variable to change: use a string contract or a parser with big-integer support when required
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For recognise receiver-side precision limits, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a test harness. Transfer recognise receiver-side precision limits into a test harness. Preserve the governing rule—A receiving JavaScript program that uses JSON.parse normally still converts a JSON number to Number and may lose precision.—while identifying what changes. Recognise receiver-side precision limits is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A receiving JavaScript program that uses JSON.parse normally still converts a JSON number to Number and may lose precision.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a nested payload. Transfer recognise receiver-side precision limits into a nested payload. Preserve the governing rule—A receiving JavaScript program that uses JSON.parse normally still converts a JSON number to Number and may lose precision.—while identifying what changes. Recognise receiver-side precision limits is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A receiving JavaScript program that uses JSON.parse normally still converts a JSON number to Number and may lose precision.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a service boundary. Transfer recognise receiver-side precision limits into a service boundary. Preserve the governing rule—A receiving JavaScript program that uses JSON.parse normally still converts a JSON number to Number and may lose precision.—while identifying what changes. Recognise receiver-side precision limits is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A receiving JavaScript program that uses JSON.parse normally still converts a JSON number to Number and may lose precision.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a large-number API response. Transfer recognise receiver-side precision limits into a large-number API response. Preserve the governing rule—A receiving JavaScript program that uses JSON.parse normally still converts a JSON number to Number and may lose precision.—while identifying what changes. Recognise receiver-side precision limits is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “A receiving JavaScript program that uses JSON.parse normally still converts a JSON number to Number and may lose precision.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for recognise receiver-side precision limits, predict the result, then use a string contract or a parser with big-integer support when required. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The receiver displays a rounded Number on the checked runtime despite exact outbound digits. The contrast follows from this rule: A receiving JavaScript program that uses JSON.parse normally still converts a JSON number to Number and may lose precision. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for recognise receiver-side precision limits, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain recognise receiver-side precision limits, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Preserve outbound large-integer digits · Full contents · Next: Feature-test and validate provenance →
CHAPTER 20 OF 20 · Back to contents
20. Feature-test and validate provenance
The short answer: Feature-test and validate provenance is best learned as a decision about the documented contract rather than as a longer snippet to memorise. The governing rule is: Because runtime availability and data trust are separate questions, check support and never pass untrusted text merely to bypass normal serialization.. This is the sentence a learner should be able to say before touching a keyboard. It turns a vague topic into a testable model and gives a parent or tutor something precise to listen for.
The implementation applies the rule “Because runtime availability and data trust are separate questions, check support and never pass untrusted text merely to bypass normal serialization.”. A minimal fixture exposes the relevant input and observation while excluding unrelated project state. That mechanism matters because superficially similar examples can produce different results. A reliable explanation names the relevant object, identifies the operation performed on it, and states when the decision is made. “It works” is not enough; mastery means predicting the result and explaining why a nearby example behaves differently.
Worked example: predict before running
Read the feature-test and validate provenance example once without executing it. Mark the exact input, the operation under study, and the expected observable result. Then write a one-sentence prediction. Only after that should the learner run the example. This order separates understanding from trial-and-error and makes any surprise diagnostically useful.
if(typeof JSON.rawJSON==='function'){
const digits=/^-?(0|[1-9]\d*)$/.test(input)?input:null;
if(digits!==null) payload.id=JSON.rawJSON(digits);
}
Expected result and reasoning. The pattern illustrates an application-specific integer policy before the built-in JSON validation. The important evidence is not merely the printed value or exit status. It is the connection between that evidence and the rule above. Say the chain aloud: input → relevant rule → operation → observable result. If a learner cannot supply the middle two links, the right response is to revisit the model rather than add more examples.
Near miss. A support check does not establish that a fragment is semantically authorised or appropriate for an API contract. This is tempting because it uses a familiar word or visual resemblance. Correct it by changing only one variable at a time and comparing the two cases side by side. A good contrast preserves everything except the feature named in the rule.
Diagnostic route when the answer is wrong
Use a four-pass diagnosis. Pass one: classify. Identify the kind of value or state being examined. Pass two: trace. Follow the operation in the order defined by the platform or specification. Pass three: observe. Capture a minimal output, not a screenshot of a large project. Pass four: contrast. Change one feature and run again. For this chapter, the highest-value question is: “Who produced the text, what grammar is allowed, and does the receiver support it?”
- Evidence to collect: the exact input, environment version, observed result and governing rule for feature-test and validate provenance
- Variable to hold constant: the surrounding setup, so the comparison isolates feature-test and validate provenance.
- Variable to change: test unsupported runtime, invalid input and valid trusted input separately
- Explanation standard: name the rule, not merely the successful command or copied syntax.
For feature-test and validate provenance, a common unproductive move is to make several changes at once. That can make the symptom disappear while leaving the misconception intact. Reset to the smallest example, keep a brief prediction log, and preserve both the successful and unsuccessful case. The pair becomes a reusable test fixture and a much clearer revision note than a paragraph of definitions.
Four transfer cases
Transfer case 1: a compatibility check. Transfer feature-test and validate provenance into a compatibility check. Preserve the governing rule—Because runtime availability and data trust are separate questions, check support and never pass untrusted text merely to bypass normal serialization.—while identifying what changes. Feature-test and validate provenance is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “Because runtime availability and data trust are separate questions, check support and never pass untrusted text merely to bypass normal serialization.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 2: a data-validation lesson. Transfer feature-test and validate provenance into a data-validation lesson. Preserve the governing rule—Because runtime availability and data trust are separate questions, check support and never pass untrusted text merely to bypass normal serialization.—while identifying what changes. Feature-test and validate provenance is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “Because runtime availability and data trust are separate questions, check support and never pass untrusted text merely to bypass normal serialization.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 3: a regression suite. Transfer feature-test and validate provenance into a regression suite. Preserve the governing rule—Because runtime availability and data trust are separate questions, check support and never pass untrusted text merely to bypass normal serialization.—while identifying what changes. Feature-test and validate provenance is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “Because runtime availability and data trust are separate questions, check support and never pass untrusted text merely to bypass normal serialization.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Transfer case 4: a ledger export. Transfer feature-test and validate provenance into a ledger export. Preserve the governing rule—Because runtime availability and data trust are separate questions, check support and never pass untrusted text merely to bypass normal serialization.—while identifying what changes. Feature-test and validate provenance is best learned as a decision about the documented contract rather than as a longer snippet to memorise. Record input, prediction, observation and version so disagreement becomes diagnosable. Start by naming the observable evidence, then apply the chapter rule “Because runtime availability and data trust are separate questions, check support and never pass untrusted text merely to bypass normal serialization.”. Do not jump straight to a command or syntax change. First predict the outcome, perform the smallest safe check, and compare the result with that prediction. This makes the case useful beyond the immediate exercise: the learner is practising a decision process, not memorising a one-off answer. If the result differs, record what changed—platform, input shape, repository state, document tree, or evaluation order—before revising the model.
Practice, pause point, and explained answer
Task. Rebuild the example for feature-test and validate provenance, predict the result, then test unsupported runtime, invalid input and valid trusted input separately. Explain both outcomes without trial and error. Before checking anything, write (1) the predicted result, (2) the rule that justifies it, and (3) one nearby variation that should change the result. A complete response should be understandable to someone who has not seen the example.
Explained answer. The pattern illustrates an application-specific integer policy before the built-in JSON validation. The contrast follows from this rule: Because runtime availability and data trust are separate questions, check support and never pass untrusted text merely to bypass normal serialization. The reasoning earns more attention than the final value. If the learner reached the correct result by guessing, repeat the task with the variation they proposed. If they can predict both cases and explain the contrast, the idea is beginning to transfer.
Parent and tutor decision point
Ask the learner to name the evidence that matters for feature-test and validate provenance, then request one controlled variation. A correct value without a causal explanation is not yet mastery. A useful conversation is brief: ask for the rule, ask for a prediction, then ask which observation would disprove it. Avoid turning the exchange into a vocabulary quiz. The goal is to hear a causal explanation and see a controlled test. Praise a corrected prediction when the learner uses evidence well; that is stronger progress than protecting an unexamined first answer.
Ready to move on? Move forward when the learner can explain feature-test and validate provenance, solve the worked case without prompts, and handle at least two transfer cases with a changed context. Revisit this chapter when the explanation relies on “usually”, “looks like”, or “the computer says so” without identifying the governing rule.
← Previous: Recognise receiver-side precision limits · Full contents · Parent guide →
Parent guide: what mastery looks like
A learner has not mastered JavaScript JSON.rawJSON merely because one polished example runs. Look for four behaviours: they can state the rule in plain language; predict before executing; isolate one changed condition; and explain why a transfer case is the same problem or a different one. Those behaviours make progress visible without requiring a parent to become a specialist.
Use a ten-minute check-in. Ask the learner to choose one chapter, reconstruct its example from memory, and narrate the causal chain. Then change one input. If the learner can update the prediction and justify the change, stop. More repetitions are not automatically better. Save the two-case pair and return to it after a few days.
If every answer is hesitant, reduce the scope. Return to the earliest chapter whose rule cannot be stated accurately. If explanations are fluent but real tasks still fail, move to a capstone because the missing skill is likely transfer or diagnosis. If frustration rises, separate typing errors from conceptual errors and solve only one category in that session.
Capstone practice with explained routes
Capstone 1: Rebuild the smallest trustworthy fixture
Scenario. Create a disposable JavaScript fixture that demonstrates validated primitive JSON source text without unrelated code.
Route. Record environment, input, prediction and output. Keep one nearby contrast. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. Another learner can reproduce the observation and explain the separating rule. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 2: Diagnose a believable wrong explanation
Scenario. A learner has the correct output but the wrong mechanism.
Route. Change the condition the wrong explanation says matters while holding the real condition constant. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. The controlled contrast exposes the misconception. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 3: Handle a version boundary
Scenario. Two environments produce different observations.
Route. Capture versions, platform, exact input and relevant state. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. Bind the claim to the documented environment and retest. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 4: Design a parent check-in
Scenario. A parent has ten minutes and no specialist background.
Route. Ask for one rule, prediction, run and changed condition. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. The learner demonstrates mastery through causal explanation. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 5: Transfer into a larger project
Scenario. The isolated fixture works but a project does not.
Route. Preserve the fixture, then compare dependencies one at a time. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. The first dependency that changes the result becomes the next diagnostic focus. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 6: Write a regression check
Scenario. The behaviour must remain understood after an update.
Route. Save the positive case, near miss and version metadata. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. A useful check reports a meaningful changed observation. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 7: Explain a limitation honestly
Scenario. The feature does not cover an important job or is unavailable.
Route. Name the limitation and the safer route. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. Good advice is bounded rather than stretched into a guarantee. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Capstone 8: Choose the right tool
Scenario. Several related APIs or commands appear equivalent.
Route. Define output, timing, compatibility and failure modes. Begin with a written prediction, collect the smallest sufficient evidence, and explain which observation would make you revise the conclusion.
Explained resolution. Choose the contract that matches the job and reject a tempting mismatch. A strong submission includes the result, the causal chain and a controlled contrasting case. It does not hide uncertainty: if platform, version or environment matters, state that boundary.
Frequently asked questions
Is JavaScript JSON.rawJSON mainly a syntax topic?
No. Syntax is the handle. Mastery means stating the contract, predicting boundary cases, collecting the right evidence and choosing a different tool when the contract does not fit.
How long should one practice session be?
Ten to twenty focused minutes is enough for one rule, one worked example, one near miss and one explanation. Save the fixture and retrieve it again after a gap.
Should every edge case be memorised?
No. Memorise the central rule and organise exceptions by version, platform, input type, browser support or repository state.
What can a non-specialist parent ask?
Ask for a prediction, the rule behind it, the observation that could disprove it and one changed case.
When is copying an example useful?
Copying establishes a baseline. It becomes learning after the student predicts, reconstructs, varies and explains it.
How do we separate setup errors from concept errors?
Run a known-good minimal fixture first. If it fails, inspect version, support and transcription. If it passes but a variation is predicted wrongly, the misconception is conceptual.
Should practice start inside a large project?
Not initially. Begin in a disposable directory, tiny script or isolated page, then transfer the verified rule.
What belongs in revision notes?
Keep one rule, the smallest successful example, a near miss, observed output, environment version and a diagnostic question.
What if two computers disagree?
Treat the difference as evidence. Record versions, exact input and relevant state, then consult the primary source.
When should the learner move on?
Move on when the learner can explain the rule, predict two contrasts, diagnose a broken case and transfer the idea without step-by-step prompting.
References and verification notes
Primary technical source: ECMAScript JSON.rawJSON specification. The ECMAScript specification defines ToString conversion, primitive-only JSON validation, the frozen null-prototype raw-JSON record, JSON.isRawJSON branding and JSON.stringify integration that emits the stored source text.
The worked examples were checked with Node.js 24.19.0; fixtures verified number, string, Boolean and null fragments; rejection of arrays, objects, emptiness, whitespace and leading zero; exponent and negative-zero preservation; freezing, null prototype, branding, nested serialization and receiver-side Number precision loss. The checks confirm the specific examples in this guide; they do not promise identical behaviour on an older version, a different operating system, a different browser implementation, or a repository with different state. Keep the version and environment with the saved fixture.
Last reviewed: 17 October 2026. This article is educational guidance for families and learners. It does not advertise a physical Punggol outlet or make admissions, affiliation, score or outcome guarantees.

