I created a cutting-edge live-tracking website for my school that features two stunning fullscreen graphs, G1 and G2. My goal is to showcase G1 for 10 minutes before switching to G2 for 2 minutes. I brainstormed a possible solution: (Not considering syntax)
hideG1(){ //similar to displaying G2
G1.hide();
G2.display();
setTimeout(hideG2, 10 minutes);
}
hideG2(){ //similar to displaying G1
G2.hide();
G1.display();
setTimeout(hideG1, 2 minutes);
}
However, the instant execution of setTimeout causes a stack overflow error, halting the rest of the code from running smoothly.
Can anyone offer a solution to this dilemma?