diff --git a/files/en-us/web/javascript/reference/global_objects/date/parse/index.md b/files/en-us/web/javascript/reference/global_objects/date/parse/index.md index 984e7f40c5f0871..7a8f358772ced91 100644 --- a/files/en-us/web/javascript/reference/global_objects/date/parse/index.md +++ b/files/en-us/web/javascript/reference/global_objects/date/parse/index.md @@ -12,7 +12,9 @@ The **`Date.parse()`** static method parses a string representation of a date, a {{InteractiveExample("JavaScript Demo: Date.parse()")}} ```js interactive-example -const unixTimeZero = Date.parse("01 Jan 1970 00:00:00 GMT"); +// Standard date-time string format +const unixTimeZero = Date.parse("1970-01-01T00:00:00Z"); +// Non-standard format resembling toUTCString() const javaScriptRelease = Date.parse("04 Dec 1995 00:12:00 GMT"); console.log(unixTimeZero); diff --git a/files/en-us/web/javascript/reference/global_objects/regexp/unicode/index.md b/files/en-us/web/javascript/reference/global_objects/regexp/unicode/index.md index 98256ee7aae7401..00cb4d6a8e5bb5a 100644 --- a/files/en-us/web/javascript/reference/global_objects/regexp/unicode/index.md +++ b/files/en-us/web/javascript/reference/global_objects/regexp/unicode/index.md @@ -9,23 +9,17 @@ browser-compat: javascript.builtins.RegExp.unicode The **`unicode`** accessor property of {{jsxref("RegExp")}} instances returns whether or not the `u` flag is used with this regular expression. -{{InteractiveExample("JavaScript Demo: RegExp.prototype.unicode", "taller")}} +{{InteractiveExample("JavaScript Demo: RegExp.prototype.unicode")}} ```js interactive-example -const regex1 = new RegExp("\u{61}"); -const regex2 = new RegExp("\u{61}", "u"); +const regex1 = new RegExp("\\u{61}"); +const regex2 = new RegExp("\\u{61}", "u"); console.log(regex1.unicode); // Expected output: false console.log(regex2.unicode); // Expected output: true - -console.log(regex1.source); -// Expected output: "a" - -console.log(regex2.source); -// Expected output: "a" ``` ## Description diff --git a/files/en-us/web/javascript/reference/global_objects/regexp/unicodesets/index.md b/files/en-us/web/javascript/reference/global_objects/regexp/unicodesets/index.md index 09b67ee259347d4..b37f1f75769fdab 100644 --- a/files/en-us/web/javascript/reference/global_objects/regexp/unicodesets/index.md +++ b/files/en-us/web/javascript/reference/global_objects/regexp/unicodesets/index.md @@ -9,6 +9,19 @@ browser-compat: javascript.builtins.RegExp.unicodeSets The **`unicodeSets`** accessor property of {{jsxref("RegExp")}} instances returns whether or not the `v` flag is used with this regular expression. +{{InteractiveExample("JavaScript Demo: RegExp.prototype.unicodeSets")}} + +```js interactive-example +const regex1 = new RegExp("[\\p{Lowercase}&&\\p{Script=Greek}]"); +const regex2 = new RegExp("[\\p{Lowercase}&&\\p{Script=Greek}]", "v"); + +console.log(regex1.unicodeSets); +// Expected output: false + +console.log(regex2.unicodeSets); +// Expected output: true +``` + ## Description `RegExp.prototype.unicodeSets` has the value `true` if the `v` flag was used; otherwise, `false`. The `v` flag is an "upgrade" to the [`u`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/unicode) flag that enables more Unicode-related features. ("v" is the next letter after "u" in the alphabet.) Because `u` and `v` interpret the same regex in incompatible ways, using both flags results in a {{jsxref("SyntaxError")}}. With the `v` flag, you get all features mentioned in the `u` flag description, plus: diff --git a/files/en-us/web/javascript/reference/operators/async_function_star_/index.md b/files/en-us/web/javascript/reference/operators/async_function_star_/index.md index 5dd5db0cb44cda1..45b65f60fbf5e9c 100644 --- a/files/en-us/web/javascript/reference/operators/async_function_star_/index.md +++ b/files/en-us/web/javascript/reference/operators/async_function_star_/index.md @@ -14,22 +14,20 @@ You can also define async generator functions using the [`async function*` decla {{InteractiveExample("JavaScript Demo: Expressions - Async Function Asterisk", "taller")}} ```js interactive-example -async function* foo() { - yield await Promise.resolve("a"); - yield await Promise.resolve("b"); - yield await Promise.resolve("c"); -} - -let str = ""; - -async function generate() { - for await (const val of foo()) { +async function joinAll(generator) { + let str = ""; + for await (const val of generator()) { str = str + val; } - console.log(str); + return str; } -generate(); +const str = generate(async function* () { + yield await Promise.resolve("a"); + yield await Promise.resolve("b"); + yield await Promise.resolve("c"); +}); +console.log(str); // Expected output: "abc" ```