Skip to content

Commit 7a86d33

Browse files
Apply suggestions from code review
Co-authored-by: Chris Mills <[email protected]>
1 parent f30c94e commit 7a86d33

File tree

8 files changed

+12
-10
lines changed

8 files changed

+12
-10
lines changed

files/en-us/web/javascript/data_structures/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Objects are ad-hoc key-value pairs, so they are often used as maps. However, the
197197

198198
### Dates
199199

200-
When representing dates, JavaScript provides two sets of APIs: the legacy {{jsxref("Date")}} object and the modern {{jsxref("Temporal")}} object. The former has many undesirable design choices and should be avoided in new code if possible. Read the {{jsxref("Temporal")}} reference page for more information.
200+
JavaScript provides two sets of APIs for representing dates: the legacy {{jsxref("Date")}} object and the modern {{jsxref("Temporal")}} object. `Date` has many undesirable design choices and should be avoided in new code if possible.
201201

202202
### Indexed collections: Arrays and typed Arrays
203203

files/en-us/web/javascript/guide/expressions_and_operators/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ where `object` is the object to test against `objectType`, and `objectType` is a
10431043
Use `instanceof` when you need to confirm the type of an object at runtime.
10441044
For example, when catching exceptions, you can branch to different exception-handling code depending on the type of exception thrown.
10451045
1046-
For example, the following code uses `instanceof` to determine whether `obj` is a `Map` object. Because `obj` is a `Map` object, the statements in the `if` statement execute.
1046+
For example, the following code uses `instanceof` to determine whether `obj` is a `Map` object. Because `obj` is a `Map` object, the statements inside the `if` block execute.
10471047
10481048
```js
10491049
const obj = new Map();

files/en-us/web/javascript/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Learn how to program in JavaScript from the ground up with our beginner's tutori
7474
Browse the complete [JavaScript reference](/en-US/docs/Web/JavaScript/Reference) documentation.
7575

7676
- [Standard objects](/en-US/docs/Web/JavaScript/Reference/Global_Objects)
77-
- : Get to know standard built-in objects {{jsxref("Array")}}, {{jsxref("Boolean")}}, {{jsxref("Error")}}, {{jsxref("Function")}}, {{jsxref("JSON")}}, {{jsxref("Math")}}, {{jsxref("Number")}}, {{jsxref("Object")}}, {{jsxref("RegExp")}}, {{jsxref("String")}}, {{jsxref("Map")}}, {{jsxref("Set")}}, {{jsxref("WeakMap")}}, {{jsxref("WeakSet")}}, and others.
77+
- : Get to know standard built-in objects: {{jsxref("Array")}}, {{jsxref("Boolean")}}, {{jsxref("Error")}}, {{jsxref("Function")}}, {{jsxref("JSON")}}, {{jsxref("Math")}}, {{jsxref("Number")}}, {{jsxref("Object")}}, {{jsxref("RegExp")}}, {{jsxref("String")}}, {{jsxref("Map")}}, {{jsxref("Set")}}, {{jsxref("WeakMap")}}, {{jsxref("WeakSet")}}, and others.
7878
- [Expressions and operators](/en-US/docs/Web/JavaScript/Reference/Operators)
7979
- : Learn more about the behavior of JavaScript's operators {{jsxref("Operators/instanceof", "instanceof")}}, {{jsxref("Operators/typeof", "typeof")}}, {{jsxref("Operators/new", "new")}}, {{jsxref("Operators/this", "this")}}, the [operator precedence](/en-US/docs/Web/JavaScript/Reference/Operators/Operator_precedence), and more.
8080
- [Statements and declarations](/en-US/docs/Web/JavaScript/Reference/Statements)

files/en-us/web/javascript/reference/global_objects/array/tolocalestring/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ The `toLocaleString()` method is [generic](/en-US/docs/Web/JavaScript/Reference/
4747

4848
### Using locales and options
4949

50-
The elements of the array are converted to strings using their `toLocaleString` methods. For example, this example implicitly calls the {{jsxref("Number.prototype.toLocaleString()")}} method to always display the currency for the strings and numbers in the `prices` array:
50+
The elements of the array are converted to strings using their `toLocaleString` methods. For example, this snippet implicitly calls the {{jsxref("Number.prototype.toLocaleString()")}} method to display the currency for the strings and numbers in the `prices` array:
5151

5252
```js
5353
const prices = ["¥7", 500, 8123, 12];

files/en-us/web/javascript/reference/global_objects/date/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ browser-compat: javascript.builtins.Date
1010
JavaScript **`Date`** objects represent a single moment in time in a platform-independent format. `Date` objects encapsulate an integral number that represents milliseconds since the midnight at the beginning of January 1, 1970, UTC (the _epoch_).
1111

1212
> [!NOTE]
13-
> With the introduction of the {{jsxref("Temporal")}} API, the `Date` object is considered a legacy feature. If the [browser compatibility](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#browser_compatibility) for `Temporal` is acceptable for your application, consider using `Temporal` for new code, and migrating existing code to use `Temporal` instead. We will be writing a usage guide soon!
13+
> With the introduction of the {{jsxref("Temporal")}} API, the `Date` object is considered a legacy feature. Consider using `Temporal` for new code and migrate existing code over to it if possible (check the [browser compatibility](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#browser_compatibility). We will be writing a usage guide soon!
1414
1515
## Description
1616

files/en-us/web/javascript/reference/global_objects/date/totemporalinstant/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ browser-compat: javascript.builtins.Date.toTemporalInstant
99

1010
The **`toTemporalInstant()`** method of {{jsxref("Date")}} instances returns a new {{jsxref("Temporal.Instant")}} object with the same {{jsxref("Temporal/Instant/epochMilliseconds", "epochMilliseconds")}} value as this date's [timestamp](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#the_epoch_timestamps_and_invalid_date).
1111

12-
Use this method to convert legacy `Date` code to the `Temporal` API, then further convert it to other {{jsxref("Temporal")}} classes as necessary.
12+
Use this method to convert legacy `Date` values to the `Temporal` API, then further convert it to other {{jsxref("Temporal")}} classes as necessary.
1313

1414
## Syntax
1515

@@ -23,7 +23,7 @@ None.
2323

2424
### Return value
2525

26-
A new {{jsxref("Temporal.Instant")}} object with the same {{jsxref("Temporal/Instant/epochMilliseconds", "epochMilliseconds")}} value as this date's timestamp. Its {{jsxref("Temporal/Instant/microsecond", "microsecond")}} and {{jsxref("Temporal/Instant/nanosecond", "nanosecond")}} fields are always `0`.
26+
A new {{jsxref("Temporal.Instant")}} object with the same {{jsxref("Temporal/Instant/epochMilliseconds", "epochMilliseconds")}} value as this date's timestamp. Its microsecond and nanosecond components are always `0`.
2727

2828
## Examples
2929

files/en-us/web/javascript/reference/global_objects/intl/datetimeformat/datetimeformat/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Intl.DateTimeFormat(locales, options)
133133
134134
##### Date-time component default values
135135

136-
If any of the date-time component options is specified, then `dateStyle` and `timeStyle` must be `undefined`. If all date-time component options and `dateStyle`/`timeStyle` are `undefined`, some default options for date-time components are set, which depend on the object that the formatting method was called with:
136+
If any of the date-time component options are specified, then `dateStyle` and `timeStyle` must be `undefined`. If all date-time component options and `dateStyle`/`timeStyle` are `undefined`, some default options for date-time components are set, which depend on the object that the formatting method was called with:
137137

138138
- When formatting {{jsxref("Temporal.PlainDate")}} and {{jsxref("Date")}}, `year`, `month`, and `day` default to `"numeric"`.
139139
- When formatting {{jsxref("Temporal.PlainTime")}}, `hour`, `minute`, and `second` default to `"numeric"`.
@@ -153,7 +153,7 @@ Implementations are required to support displaying at least the following subset
153153
- `hour`, `minute`, `second`
154154
- `hour`, `minute`
155155

156-
The date-time component styles requested may not directly correspond to a valid format supported by the locale, so the format matcher allows you to specify how to match the requested styles to the closest supported format.
156+
The date-time component styles requested might not directly correspond to a valid format supported by the locale, so the format matcher allows you to specify how to match the requested styles to the closest supported format.
157157

158158
- `formatMatcher`
159159
- : The format matching algorithm to use. Possible values are `"basic"` and `"best fit"`; the default is `"best fit"`. The algorithm for `"best fit"` is implementation-defined, and `"basic"` is [defined by the spec](https://tc39.es/ecma402/#sec-basicformatmatcher). This option is only used when both `dateStyle` and `timeStyle` are `undefined` (so that each date-time component's format is individually customizable).
@@ -167,6 +167,8 @@ The date-time component styles requested may not directly correspond to a valid
167167

168168
> **Note:** `dateStyle` and `timeStyle` can be used with each other, but not with other date-time component options (e.g. `weekday`, `hour`, `month`, etc.).
169169
170+
You can format different object types depending on which of the style shortcut options you include:
171+
170172
- If the `dateStyle` is specified, then you can format {{jsxref("Temporal.PlainDate")}}, {{jsxref("Temporal.PlainYearMonth")}}, and {{jsxref("Temporal.PlainMonthDay")}} objects.
171173
- If the `timeStyle` is specified, then you can format {{jsxref("Temporal.PlainTime")}} objects.
172174
- If either `dateStyle` or `timeStyle` is specified, then you can format {{jsxref("Temporal.PlainDateTime")}} and {{jsxref("Date")}} objects.

files/en-us/web/javascript/reference/global_objects/json/stringify/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ A JSON string representing the given value, or undefined.
6666
- if it is in an array, the index in the array, as a string
6767
- if `JSON.stringify()` was directly called on this object, an empty string
6868

69-
All {{jsxref("Temporal")}} objects implement the `toJSON()` method which returns a string (the same as calling `toString()`). Thus, they will be stringified as strings. Similarly, {{jsxref("Date")}} objects implement `toJSON()` which returns the same as [`toISOString()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString).
69+
All {{jsxref("Temporal")}} objects implement the `toJSON()` method, which returns a string (the same as calling `toString()`). Thus, they will be serialized as strings. Similarly, {{jsxref("Date")}} objects implement `toJSON()`, which returns the same as [`toISOString()`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString).
7070

7171
- Only [enumerable own properties](/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties) are visited. This means {{jsxref("Map")}}, {{jsxref("Set")}}, etc. will become `"{}"`. You can use the [`replacer`](#the_replacer_parameter) parameter to serialize them to something more useful.
7272

0 commit comments

Comments
 (0)