Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update JSON.stringify undefined cases #38673

Closed
wants to merge 1 commit into from

Conversation

codersjj
Copy link
Contributor

Description

  • Reorder the examples to align with the first sentence’s claim.
  • Add an example demonstrating JSON.stringify() returning undefined for "pure" value Symbol.

Motivation

The documentation states that "undefined, Function, and Symbol values are not valid JSON values.", but lacked a concrete example for Symbol. This change adds JSON.stringify(Symbol()) to explicitly show the behavior.

JSON.stringify(undefined)      // → undefined
JSON.stringify(() => {})       // → undefined
JSON.stringify(Symbol())       // → undefined

Additional details

Related issues and pull requests

@codersjj codersjj requested a review from a team as a code owner March 17, 2025 01:49
@codersjj codersjj requested review from Josh-Cena and removed request for a team March 17, 2025 01:49
@github-actions github-actions bot added Content:JS JavaScript docs size/xs [PR only] 0-5 LoC changed labels Mar 17, 2025
Copy link
Contributor

@Josh-Cena
Copy link
Member

Thanks, but the goal of these quick examples is never to be exhaustive. With two examples it should be trivial to figure out the third oneself.

@Josh-Cena Josh-Cena closed this Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:JS JavaScript docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants