diff --git a/removeFromArray/removeFromArray.js b/removeFromArray/removeFromArray.js index 3b9fc89..d69f9e1 100644 --- a/removeFromArray/removeFromArray.js +++ b/removeFromArray/removeFromArray.js @@ -1,8 +1,10 @@ const removeFromArray = function(...args) { - let myArray = args[0]; - let pos = 0; + let myArray = args[0]; //Create an array with the first function argument + let pos = 0; //Create a variable to store index of element + + // Remove all the remaining elements from the array for (let i = 1; i < args.length; i++) { pos = myArray.indexOf(args[i]); myArray.splice(pos, 1); diff --git a/removeFromArray/removeFromArray.spec.js b/removeFromArray/removeFromArray.spec.js index cf268c1..60903a8 100644 --- a/removeFromArray/removeFromArray.spec.js +++ b/removeFromArray/removeFromArray.spec.js @@ -4,7 +4,7 @@ describe('removeFromArray', function() { it('removes a single value', function() { expect(removeFromArray([1, 2, 3, 4], 3)).toEqual([1, 2, 4]); }); - xit('removes multiple values', function() { + it('removes multiple values', function() { expect(removeFromArray([1, 2, 3, 4], 3, 2)).toEqual([1, 4]); }); xit('ignores non present values', function() {