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
Merged
3 changes: 2 additions & 1 deletion files/en-us/web/javascript/data_structures/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Ashish-CodeJourney marked this conversation as resolved.
Show resolved Hide resolved
Ashish-CodeJourney marked this conversation as resolved.
Show resolved Hide resolved

There are two types of object properties: The [_data_ property](#data_property) and the [_accessor_ property](#accessor_property). Each property has corresponding _attributes_. Each attribute is accessed internally by the JavaScript engine, but you can set them through {{jsxref("Object.defineProperty()")}}, or read them through {{jsxref("Object.getOwnPropertyDescriptor()")}}. You can read more about the various nuances on the {{jsxref("Object.defineProperty()")}} page.

Expand Down