DEV Community

Discussion on: JavaScript: I have a problem to set the conditions of the beginnings of the loops.

Collapse
 
andybullet profile image
AndyBullet

So where should I put the line 9?

Collapse
 
dploeger profile image
Dennis Ploeger

Perhaps you could just make it broader so it accepts the values 0 and 1.

Thread Thread
 
andybullet profile image
AndyBullet

Yes, I understood it. I would like to know how to do it.

Thread Thread
 
dploeger profile image
Dennis Ploeger

Well, like this for instance:

let currentNumber = document.getElementById('Number').textContent;
if (currentNumber !== '0' && currentNumber !== '1')
  return;

It's not optimal, just for demonstration purposes.