How javascript try…catch statement works

前端 未结 5 831
伪装坚强ぢ
伪装坚强ぢ 2020-12-18 04:22

I am trying to test in browsermob if certain input field work or not. I am attempting to use a try...catch statement which I have never used before. I know that the form is:

5条回答
  •  太阳男子
    2020-12-18 04:33

    the code that is likely to throw an exception goes into try { }, The code to be run when an exception is thrown, comes into catch() { }. In catch() you can specify which exceptions you want to catch, and in which automatic variables to put it. finally { } is always run, regardless whether exception was thrown or not.

提交回复
热议问题