From 9827f09f5cb0ae32ba2eb2e0acc3d8f61a3f4b9f Mon Sep 17 00:00:00 2001 From: Michael Fasani Date: Thu, 28 May 2020 23:16:42 +0200 Subject: [PATCH] Small improvement Rearranged so that `Immutable` is above `Mutative` in both examples. --- js-array.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js-array.md b/js-array.md index 1af3d7f08..2eab3e081 100644 --- a/js-array.md +++ b/js-array.md @@ -35,6 +35,12 @@ re = list.splice(1,2) // re = [b,c] list == [a,d,e] ### Adding items +#### Immutable + +```bash +list.concat([X,Y]) // → [_,_,_,_,_,X,Y] +``` + #### Mutative ```bash @@ -43,12 +49,6 @@ list.unshift(X) // list == [X,_,_,_,_,_] list.splice(2, 0, X) // list == [_,_,X,_,_,_] ``` -#### Immutable - -```bash -list.concat([X,Y]) // → [_,_,_,_,_,X,Y] -``` - ### Inserting ```bash