Skip to content

Commit f5a2995

Browse files
author
wendy@lastlookeditorial.com
committed
Edited ch07.asciidoc with Atlas code editor
1 parent 7f32f82 commit f5a2995

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ch07.asciidoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ getNonDollarAmount('€12.34') // <- '12.34'
17201720

17211721
==== A New /s "dotAll" Flag
17221722

1723-
When ((("dotAll proposal")))((("s flagx")))((("s flagx", primary-sortas="s flag")))using the `.` pattern, we typically expect to match every single character. In JavaScript, however, a `.` expression doesn't match astral characters (which can be fixed by adding the `u` flag) nor line terminators.
1723+
When ((("dotAll proposal")))((("/s flag")))((("/s flag", primary-sortas="s flag")))using the `.` pattern, we typically expect to match every single character. In JavaScript, however, a `.` expression doesn't match astral characters (which can be fixed by adding the `u` flag) nor line terminators.
17241724

17251725
[source,javascript]
17261726
----
@@ -1752,7 +1752,7 @@ rcharacter.test('\n') // <- true
17521752

17531753
==== String#matchAll
17541754

1755-
Often, when we ((("StringmatchAll proposalx", id="smap7")))have a regular expression with a global or sticky flag, we want to iterate over the set of captured groups for each match. Currently, it can be a bit of a hassle to produce the list of matches: we need to collect the captured groups using `String#match` or `RegExp#exec` in a loop, until the regular expression doesn't match the input starting at the `lastIndex` position property. In the following piece of code, the `parseAttributes` generator function does just that for a given regular expression.
1755+
Often, when we ((("String#matchAll proposal", id="smap7")))have a regular expression with a global or sticky flag, we want to iterate over the set of captured groups for each match. Currently, it can be a bit of a hassle to produce the list of matches: we need to collect the captured groups using `String#match` or `RegExp#exec` in a loop, until the regular expression doesn't match the input starting at the `lastIndex` position property. In the following piece of code, the `parseAttributes` generator function does just that for a given regular expression.
17561756

17571757
[source,javascript]
17581758
----
@@ -1859,7 +1859,7 @@ console.log(addressMatcher.next().value)
18591859
// <- ['placeholder', 'Enter your business address']
18601860
----
18611861

1862-
The `String#matchAll` proposalpass:[<span data-type="footnote" id="string-matchall">Check out the <a href="https://mjavascript.com/out/string-matchall"><code>String#matchAll</code> proposal document</a>.</span>] (in stage 1 at the time of this writing) introduces a new method for the string prototype that would behave in a similar fashion as our `matchAll` implementation, except the returned iterable is a sequence of `match` objects as opposed to just the `captures` in the preceding example. Note that the `String#matchAll` sequence contains entire `match` objects, and not just numbered captures. This means we could access named captures through `match.groups` for each `match` in the ((("StringmatchAll proposalx", startref="smap7")))((("regular expressions", startref="rege7")))((("matchAll", startref="ma7")))sequence.
1862+
The `String#matchAll` proposalpass:[<span data-type="footnote" id="string-matchall">Check out the <a href="https://mjavascript.com/out/string-matchall"><code>String#matchAll</code> proposal document</a>.</span>] (in stage 1 at the time of this writing) introduces a new method for the string prototype that would behave in a similar fashion as our `matchAll` implementation, except the returned iterable is a sequence of `match` objects as opposed to just the `captures` in the preceding example. Note that the `String#matchAll` sequence contains entire `match` objects, and not just numbered captures. This means we could access named captures through `match.groups` for each `match` in the ((("String#matchAll proposal", startref="smap7")))((("regular expressions", startref="rege7")))((("matchAll", startref="ma7")))sequence.
18631863

18641864
[source,javascript]
18651865
----
@@ -1940,7 +1940,7 @@ Array.from($('div'))
19401940
// <- [<div>, <div>, <div>, …]
19411941
----
19421942

1943-
The one thing you cannot do with either `Array.from` nor the spread operator is to pick a start index. Suppose you wanted to pull every `<div>` after the first one. With `Array#slice`, you ((("Arrayslicex")))could do the following.
1943+
The one thing you cannot do with either `Array.from` nor the spread operator is to pick a start index. Suppose you wanted to pull every `<div>` after the first one. With `Array#slice`, you ((("Array#slice")))could do the following.
19441944

19451945
[source,javascript]
19461946
----
@@ -2048,7 +2048,7 @@ console.log(Array.of(-1)) // <- [-1]
20482048

20492049
==== Array#copyWithin
20502050

2051-
Let's start with the ((("ArraycopyWithinx", id="acw7")))signature of `Array#copyWithin`.
2051+
Let's start with the ((("Array#copyWithin", id="acw7")))signature of `Array#copyWithin`.
20522052

20532053
[source,javascript]
20542054
----

0 commit comments

Comments
 (0)