/*
Removes first all items from array.
Returns nothing.
*/
function removeFromArrayAll(array, item) {
while (true) {
if (removeFromArray(array, item) == null) {
break
}
}
}
/*
Removes first item from array.
Returns removed item or null.
*/
function removeFromArray(array, item) {
let index = array.indexOf(item);
if (index != -1) {
return array.splice(index, 1)[0]
}
return null;
}