Added html file to debug in browser console

This commit is contained in:
Eric Holland 2023-11-04 20:26:28 -04:00
parent 88fc7f3aed
commit d13b907660
2 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="removeFromArray.js"></script>
</head>
<body>
</body>
</html>

View File

@ -1,5 +1,22 @@
const removeFromArray = function() {
const removeFromArray = function(array) {
const removalChecks = [];
for (i=0; i<arguments.length; ++i) {
if (i !== 0) {
removalChecks.push(arguments[i]);
}
}
console.log(removalChecks)
lenArray = array.length-1;
for (i=0; i<removalChecks.length; i++) {
valToCheck = removalChecks[i]
for (i=lenArray; i>=0; --i) {
if (array[i] == valToCheck) {
array.splice(i, 1)
}
}
}
return array
};
// Do not edit below this line