Use of try-catch in JavaScript

前端 未结 4 505
隐瞒了意图╮
隐瞒了意图╮ 2021-02-05 15:26

How time-intensive is the use of try/catch in JavaScript? I have an application and I am using it in a function which is called a few hundred times. N

4条回答
  •  情歌与酒
    2021-02-05 15:52

    In general, code executed inside a try block is expensive. But if you are invoking a try block on the order of a few hundred times, it's probably not an issue. If it were a few hundred thousand, you may want to re-think your design.

提交回复
热议问题