const removeFromArray = function(array, ...remove) {
    remove.forEach(element => {
        let findIndexElement = array.findIndex(x => x === element);
        if (findIndexElement >= 0) {
            let saveArray = [];
            for (let i = 0, arrayLength = array.length; i < arrayLength - findIndexElement - 1; i++) {
                saveArray.push(array.pop());
            }
            array.pop();
            for (let i = 0; i < saveArray.length; i++) {
                array.push(saveArray[saveArray.length - 1 - i]);
            } 
        }
    });
    return array;
};

// Do not edit below this line
module.exports = removeFromArray;
