From 18f9e5a644f68f4fec7cf72b9bbd175af8cc3f67 Mon Sep 17 00:00:00 2001 From: Jeroendevr Date: Wed, 26 Jan 2022 10:40:00 +0100 Subject: [PATCH] view shallow copy output Just a addition so the reader knows what the output of this shallow copy is using the spread operator. As I myself was wondering if there is a difference between var arrCopy = [ ...arr ]; or arrCopy = arr; --- get-started/ch3.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/get-started/ch3.md b/get-started/ch3.md index 43be80556..2cf8ed18d 100644 --- a/get-started/ch3.md +++ b/get-started/ch3.md @@ -102,6 +102,8 @@ Since arrays are iterables, we can shallow-copy an array using iterator consumpt ```js var arrCopy = [ ...arr ]; +arrCopy; +// [ 10, 20, 30 ] ``` We can also iterate the characters in a string one at a time: