What is the benefit of break in JS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the benefit of break in JS

I mean if we want to stop the code after some time we can make a loop till there only What's the need to break

23rd Jul 2020, 5:53 AM
Raghu Rao
Raghu Rao - avatar
6 Answers
+ 2
Raghubir Yadav , what if we don't know how many times the loop should run and we want to break it only if certain condition is met?
23rd Jul 2020, 5:57 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
23rd Jul 2020, 5:56 AM
ツSampriya😘ツ
ツSampriya😘ツ - avatar
+ 2
If you have to stop the loop for multiple condition we use break.Its very useful.
23rd Jul 2020, 5:59 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
I wanted to know what is the benefit I mean we can simply make a loop till the ending which we want Why to break in between
23rd Jul 2020, 5:58 AM
Raghu Rao
Raghu Rao - avatar
+ 1
in loop you can use multiple break statement .
23rd Jul 2020, 5:59 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 1
Thanks to all
23rd Jul 2020, 6:00 AM
Raghu Rao
Raghu Rao - avatar