[removed] What's more efficient, IF block or TRY/CATCH?

前端 未结 7 1254
忘了有多久
忘了有多久 2020-12-14 08:55

I\'d love some other opinions on what\'s more efficient in this code. Basically in the following code, there\'s a setInterval loop and I need 4 requirements to be true befor

7条回答
  •  感情败类
    2020-12-14 09:33

    Exceptions should be used for exceptional circumstances (i.e. things that you don't expect to happen normally). You should not, in general, use exceptions to catch something that you can test for with an if statement.

    Also, from what I understand, exceptions are much more expensive than if statements.

提交回复
热议问题