Modify rule S4043: Delimite consecutive snippets with a description (#2725)
This commit is contained in:
parent
5dec24baf9
commit
7a83669eb3
@ -26,13 +26,16 @@ const reversed = a.toReversed();
|
||||
const sorted = b.toSorted();
|
||||
----
|
||||
|
||||
Alternatively, change a mutating method into a non-mutating alternative using the spread syntax (`...`) or `slice()` to create a copy first.
|
||||
Alternatively, change a mutating method into a non-mutating alternative using the spread syntax (`...`).
|
||||
|
||||
[source,javascript,diff-id=1,diff-type=compliant]
|
||||
----
|
||||
const reversed = [...a].reverse();
|
||||
const sorted = [...b].sort();
|
||||
----
|
||||
|
||||
Or `slice()` to create a copy first.
|
||||
|
||||
[source,javascript,diff-id=1,diff-type=compliant]
|
||||
----
|
||||
const reversed = a.slice().reverse();
|
||||
|
Loading…
x
Reference in New Issue
Block a user