A Coding Problem I Solved

Owen Abbott
1 min readSep 27, 2020

--

When I was making my blackjack app, I was stuck trying to get “setInterval” to work. “While” loops kept breaking the program.

Ultimately, I solved it by making a function that used the interval I was declaring as an optional parameter in one of the functions that was related to it. If the parameter did not equal null, there was a condition for which the interval to be cleared.

Thus solving the problem forever.

I realized later that a ‘do…while’ loop would probably have been more conventional, but the solution worked for my purposes.

--

--

No responses yet