Skip to content
Advertisement

Tag: infinite-loop

My while loop in JavaScript gets stuck in an infinite loop when the subtractive condition is included

I’m doing this exercise where you have to calculate the number of limes needed to get the juice. It needs a switch statement inside which takes out the first element of the “limes” array, (and that works flawlessly). Until i add the condition to count down the wedges: even if in the cases is specified to subtract a determined amount,

Advertisement