From 460473a87ffb944ceee8cdcfa9076922bde36f10 Mon Sep 17 00:00:00 2001 From: Nuno Vieira Date: Thu, 30 Jul 2020 14:25:15 +0100 Subject: [PATCH] Fix expected result of immutable remove operation --- javascript/immutable-remove-with-the-spread-operator.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/javascript/immutable-remove-with-the-spread-operator.md b/javascript/immutable-remove-with-the-spread-operator.md index 3e1db42c..4886ea6f 100644 --- a/javascript/immutable-remove-with-the-spread-operator.md +++ b/javascript/immutable-remove-with-the-spread-operator.md @@ -15,10 +15,8 @@ const remove = (items,index) => { }; const list = [1,2,3,4,5]; -remove(list, 2); -// [1,2,3,4] -list -// [1,2,3,4,5] +remove(list, 2); // [1,2,4,5] +// list still [1,2,3,4,5] ``` It only took a couple lines of code and immutability is baked in.