Javascript Try-Catch Performance Vs. Error Checking Code

前端 未结 7 1804
萌比男神i
萌比男神i 2020-11-28 09:56

Would it be faster to just put code inside a try-catch block instead of performing various error checks?

For example..

function getProjectTask(projec         


        
7条回答
  •  爱一瞬间的悲伤
    2020-11-28 10:24

    Sure, it makes for more compact code, but it reduces your debug ability and makes adding graceful error-recovery, or useful error messages much, much, harder.

提交回复
热议问题