From f0c8df60817495c72c7a0aac497cc6f0025dbfc0 Mon Sep 17 00:00:00 2001 From: NetMan <13informatyka14@gmail.com> Date: Fri, 5 Jan 2024 21:25:10 +0100 Subject: [PATCH] Passed the fourth test from exercise 04 --- 04_removeFromArray/removeFromArray.js | 3 ++- 04_removeFromArray/removeFromArray.spec.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/04_removeFromArray/removeFromArray.js b/04_removeFromArray/removeFromArray.js index 41637e4..269fb51 100644 --- a/04_removeFromArray/removeFromArray.js +++ b/04_removeFromArray/removeFromArray.js @@ -8,13 +8,14 @@ const removeFromArray = function(array, ...remove) { } array.pop(); for (let i = 0; i < saveArray.length; i++) { - array.push(saveArray[i]); + array.push(saveArray[saveArray.length - 1 - i]); } } }); return array; }; +removeFromArray([1, 2, 3, 4], 7, 2); // Do not edit below this line module.exports = removeFromArray; diff --git a/04_removeFromArray/removeFromArray.spec.js b/04_removeFromArray/removeFromArray.spec.js index 6c26e82..0574d85 100644 --- a/04_removeFromArray/removeFromArray.spec.js +++ b/04_removeFromArray/removeFromArray.spec.js @@ -10,7 +10,7 @@ describe('removeFromArray', () => { test('ignores non present values', () => { expect(removeFromArray([1, 2, 3, 4], 7, "tacos")).toEqual([1, 2, 3, 4]); }); - test.skip('ignores non present values, but still works', () => { + test('ignores non present values, but still works', () => { expect(removeFromArray([1, 2, 3, 4], 7, 2)).toEqual([1, 3, 4]); }); test.skip('can remove all values', () => {