8000 Implement solution for the first test case · MonsWriter/javascript-exercises@88e073b · GitHub
[go: up one dir, main page]

Skip to content

Commit 88e073b

Browse files
committed
Implement solution for the first test case
1 parent 4321706 commit 88e073b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

04_removeFromArray/removeFromArray.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
const removeFromArray = function() {
2-
1+
const removeFromArray = function(inputArray, elementToRemove) {
2+
const indexOfElementToRemove = inputArray.indexOf(elementToRemove);
3+
inputArray.splice(indexOfElementToRemove, 1);
4+
return inputArray;
35
};
46

57
// Do not edit below this line

0 commit comments

Comments
 (0)
0