Modify rule S4043: Delimite consecutive snippets with a description (#2725)

This commit is contained in:
Yassin Kammoun 2023-07-31 19:51:39 +02:00 committed by GitHub
parent 5dec24baf9
commit 7a83669eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();