0
[solved] Code Playground Problem
why my code doesn't work when I try to run it from mobile application while it is working when I try to run it from the website ? I also tried it on my browser and it is working fine
4 Answers
+ 4
Full browsers are sometimes better at hiding errors. I had to delete lines 2 and 3 to get it running in Chromium (the limited version of Chrome run by CodePlayground).
line 1: Replace comma with ; -- the comma chain doesn't call the two functions as expected.
line 2: clearInterval - You can remove this.
line 3: replace with startCountdown();
line 5: add a function definition (from line 3) and save a handle for the interval.
line 13: clear it so it stops running
Summary:
var seconds = prompt(...);
startCountdown();
function startCountdown() {
var savedHandle = setInterval(function(){...})
...
clearInterval(savedHandle);
+ 4
CodePlayground link?
0
Yea forgot to include this :D
https://code.sololearn.com/Ww6R184xJuTL/#html
0
Thank you so much! This is a great answer