JavaScript catch parameter already defined

前端 未结 4 891
有刺的猬
有刺的猬 2021-02-01 05:57

I\'m trying to understand why I\'m getting the following error, not how to work around it.

Passing the following code to JSLint or JSHint yields the er

4条回答
  •  不知归路
    2021-02-01 06:48

    You can have a problem with reusing the same parameter name in sequential try-catches if you later need to refer to the error.

    If more than one catch was called, only the last one will be in scope for a finally or function scope expression.

    jsLint is conservative- if you can prevent a possible screw up with a unique variable, why not use it?

提交回复
热议问题