2024-01-05 20:21:36 +00:00
|
|
|
const removeFromArray = function(array, ...remove) {
|
|
|
|
remove.forEach(element => {
|
|
|
|
let findIndexElement = array.findIndex(x => x == element);
|
2024-01-05 20:22:30 +00:00
|
|
|
if (findIndexElement >= 0) {
|
|
|
|
let saveArray = [];
|
2024-01-05 20:33:43 +00:00
|
|
|
for (let i = 0, arrayLength = array.length; i < arrayLength - findIndexElement - 1; i++) {
|
2024-01-05 20:22:30 +00:00
|
|
|
saveArray.push(array.pop());
|
|
|
|
}
|
|
|
|
array.pop();
|
|
|
|
for (let i = 0; i < saveArray.length; i++) {
|
2024-01-05 20:25:10 +00:00
|
|
|
array.push(saveArray[saveArray.length - 1 - i]);
|
2024-01-05 20:22:30 +00:00
|
|
|
}
|
2024-01-05 20:21:36 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
return array;
|
2024-01-05 19:11:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Do not edit below this line
|
|
|
|
module.exports = removeFromArray;
|