-1

when breaking out of Nested loops in javascript would it be better (as in faster, less problematic, or more popular) to break using a try-catch-throw like a lot of people do in python, or have a self-executing function that returns out of the loops?

2

1 Answer 1

3

You should use throw if you encounter a problem that means you cannot continue.

Use return to indicate you want to exit the function.

Using errors in place of control flow gives the wrong impression about your intent.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.