I have a website with some animations when it starts, and I want to add a skip-animation button. Currently the animation is a function with lots of awaits, so how can I quit from this process when the skip-animation button is clicked? Indeed I can just add if (condition === true) {return;} between every line, but are there some easier ways of doing this?
For example, how can I immediately quit from this animation function when the skip-animation button is clicked?
var skip-animation = document.querySelector("#skip-animation);
function animation() {
await function1();
await function2();
function3();
await function4();
function5();
}