JavaScript catch parameter already defined

前端 未结 4 887
有刺的猬
有刺的猬 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:50

    Check this answer out: JSLint complaining about my try/catch

    As has mentioned, try opens a new block-scope. See https://developer.mozilla.org/en/JavaScript/Reference/Scope_Cheatsheet

    Indeed the top of the document explains that it's not all standard, but in ES5, section 12.14 the section on executing a catch block clearly defines MDC's description as standard:

    No matter how control leaves the Block the LexicalEnvironment is always restored to its former state.

提交回复
热议问题