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', () => {