From 30c4905bc5b974e9042019b6585434ed0ddfbc89 Mon Sep 17 00:00:00 2001 From: nicoleta-tuturuga Date: Mon, 9 Mar 2020 17:51:41 +0200 Subject: [PATCH] clean clean ns-2 --- index.html | 13 +++++++++++++ index.js | 24 ++++++++---------------- index.zip | Bin 0 -> 379 bytes 3 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 index.html create mode 100644 index.zip diff --git a/index.html b/index.html new file mode 100644 index 0000000..cb4c0c6 --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + Document + + + + + + + \ No newline at end of file diff --git a/index.js b/index.js index df5e6b9..2caec9f 100644 --- a/index.js +++ b/index.js @@ -1,20 +1,12 @@ -var sumArrAy = 0; +let sumArray = 0; +addArrayFinalSum = (arr) => { + for (let index = 0; index < arr.length; index++) { + sumArray += arr[index] + } + return sumArray; +} +console.log(`Sum is: ${addArrayFinalSum([1, 2, 3, 4, 5, 6])}`); -function addArrayFinalSum(arr) { - for (let index = 0, len = arr.length; index < len; index++) { - - if (typeof arr[index] !== 'number') { - sumArrAy = sumArrAy + addArrayFinalSum(arr[index]) - - } else { - sumArrAy = sumArrAy + arr[index] - } - } - response = sumArrAy; - return response; - console.log("got here!!!"); -} -console.log('abc:', addArrayFinalSum([1,2,3,4,5,6])); diff --git a/index.zip b/index.zip new file mode 100644 index 0000000000000000000000000000000000000000..2dcf6f9af6cc71b690582485e04715aa874f42f9 GIT binary patch literal 379 zcmWIWW@Zs#U|`^2=;+K0IMHpy_!P)n#|RQ(V93l%Nv+V!Dy|JU+tq9!uuuFKU$VYd z+ou2RrM6!->2ElG$$8ac(WIbbDUp%C-pyT+%hjqjq2}aw)#n(mcKFFMP>YV-7T z>-?>km*)1eMTVX^`Ed8upuaoxCc0?;(HCdfs^}pSl~LMSe^19@VcLONri+iseVX~_ z)0vtRn+zM2E4G-blvylVxi{OIt4u(Y^~kN#>LnGc%=#{5G~BH1R@B%##gcKAT+&&+mTPcxU?j zjXUa(e~aAH5&lu_-qGWFU(Xo_cr!BDGvEpg6<~0HfC89A1PvEdgpomlfn`~!tm?O` YjOcWLH!B-R8zT@#0cmbv@G>v}0NNUmx&QzG literal 0 HcmV?d00001