From 5abc57430c6d63ea92162da2506a02ea254ebce6 Mon Sep 17 00:00:00 2001 From: Kshitij961968 <57974500+Kshitij961968@users.noreply.github.com> Date: Thu, 1 Oct 2020 06:21:24 -0700 Subject: [PATCH] Update array.js --- scripts/array.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/array.js b/scripts/array.js index f3ca0e5..b43bc9a 100644 --- a/scripts/array.js +++ b/scripts/array.js @@ -9,9 +9,6 @@ function arrayEqual(arr1,arr2) { } function copyArray(arr1) { - var arr2 = new Array(); - for(var i = 0 ; i < arr1.length ; i++ ) { - arr2[i] = arr1[i]; - } - return arr2; -} \ No newline at end of file + //ES6 way to copy an array + const arr2 = [...arr1]; +}