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

Mentioned that other data types can be used to index objects #33892

Merged
merged 7 commits into from
Jun 4, 2024

Conversation

Ashish-CodeJourney
Copy link
Contributor

Description

Property keys in JavaScript objects can be strings, symbols, numbers, or even objects themselves, allowing for a wide range of data types to be used as keys for indexing objects.

This revised statement reflects the broader range of data types that can be used as property keys in JavaScript objects.

Mentioned that other data types can be used to index objects

Motivation

Additional details

#33872 (comment)

Related issues and pull requests

Fixes #33872

@Ashish-CodeJourney Ashish-CodeJourney requested a review from a team as a code owner June 3, 2024 07:05
@Ashish-CodeJourney Ashish-CodeJourney requested review from teoli2003 and removed request for a team June 3, 2024 07:05
@github-actions github-actions bot added Content:JS JavaScript docs size/xs [PR only] 0-5 LoC changed labels Jun 3, 2024
@@ -155,7 +155,8 @@ In computer science, an object is a value in memory which is possibly referenced

### Properties

In JavaScript, objects can be seen as a collection of properties. With the [object literal syntax](/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#object_literals), a limited set of properties are initialized; then properties can be added and removed. Object properties are equivalent to key-value pairs. Property keys are either [strings](#string_type) or [symbols](#symbol_type). Property values can be values of any type, including other objects, which enables building complex data structures.
In JavaScript, objects can be seen as a collection of properties. With the [object literal syntax](/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#object_literals), a limited set of properties are initialized; then properties can be added and removed. Object properties are equivalent to key-value pairs. Property keys in JavaScript objects can be [strings](#string_type), [symbols](#symbol_type), [numbers](#number_type), or even [objects](#object_type) themselves, allowing for a wide range of data types to be used as keys for indexing objects.
Property values can be values of any type, including other objects, which enables building complex data structures.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mdn-linter] reported by reviewdog 🐶

Suggested change
Property values can be values of any type, including other objects, which enables building complex data structures.
Property values can be values of any type, including other objects, which enables building complex data structures.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Josh-Cena does it looks good now ?

Copy link
Contributor

github-actions bot commented Jun 3, 2024

Preview URLs

(comment last updated: 2024-06-04 09:34:40)

@Josh-Cena
Copy link
Member

I specifically asked in my review comment that you should not say "property keys can be numbers" but that "you can use numbers to index objects and the number will be converted to a string". I don't know why your last commit reverted it to the previous state.

@Ashish-CodeJourney
Copy link
Contributor Author

I specifically asked in my review comment that you should not say "property keys can be numbers" but that "you can use numbers to index objects and the number will be converted to a string". I don't know why your last commit reverted it to the previous state.

I don't know either, why it reverted, but you can review latest commit

@Josh-Cena
Copy link
Member

You can go to https://github.com/mdn/content/pull/33892/files to see what your whole PR is proposing to change. You should make it incorporate my suggestion

Copy link
Contributor Author

@Ashish-CodeJourney Ashish-CodeJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Josh-Cena incorporated

@Josh-Cena
Copy link
Member

Have you checked the files tab? I do see any difference

@Ashish-CodeJourney
Copy link
Contributor Author

Have you checked the files tab? I do see any difference

Yes i checked it looks good (as you suggested earlier)

Copy link
Member

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here was what I suggested

files/en-us/web/javascript/data_structures/index.md Outdated Show resolved Hide resolved
Co-authored-by: Joshua Chen <sidachen2003@gmail.com>
@Ashish-CodeJourney
Copy link
Contributor Author

Here was what I suggested

Okay got it why it reverted to previous state
does it looks good now ?

Copy link
Member

@Josh-Cena Josh-Cena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

files/en-us/web/javascript/data_structures/index.md Outdated Show resolved Hide resolved
@Josh-Cena Josh-Cena merged commit 65370f7 into mdn:main Jun 4, 2024
8 checks passed
@Ashish-CodeJourney Ashish-CodeJourney deleted the feature/33872 branch June 4, 2024 09:49
@Ashish-CodeJourney Ashish-CodeJourney restored the feature/33872 branch June 24, 2024 04:55
@Ashish-CodeJourney Ashish-CodeJourney deleted the feature/33872 branch June 24, 2024 04:55
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.

Mention that other data types can be used to index objects
2 participants