You used (machineActive === false) (task 2) and (machineActive === true) (task 4). These can be shortened to (!machineActive) and (machineActive). You already did it in task 3.
Most learner struggle with finding this unusual way of using switch, but your decision was correct. When you think about what switch essentially does: It compares the value after switch with the values after case and executes the code if they match. So the behavior makes total sense (although it isnโt the โclassicโ example of using the switch statement).