+ 3

Why isnt the break statement working in js?

https://code.sololearn.com/WNXgRn05UVOS/?ref=app

16th Feb 2019, 11:52 PM
Gavin Macpherson
Gavin Macpherson - avatar
3 Réponses
+ 12
Break statement works inside a loop not in a conditional. If is not a loop. U don't need else statement in your code. Just leave if statement and Ur work will be done.
17th Feb 2019, 12:00 AM
Arushi Singhania
Arushi Singhania - avatar
+ 4
Ok thanks
17th Feb 2019, 12:01 AM
Gavin Macpherson
Gavin Macpherson - avatar
+ 4
I changed it to a for loop
17th Feb 2019, 12:08 AM
Gavin Macpherson
Gavin Macpherson - avatar