var Statement

JavaScript allows var definitions to occur anywhere within a function. JSLint is stricter.

JSLint expects that:

  • A var will be declared only once, and that it will be declared before it is used.

  • A function will be declared before it is used.

  • Parameters will not also be declared as vars.

JSLint does not expect:

  • The arguments array to be declared as a var.

  • That a variable will be declared in a block. This is because JavaScript blocks do not have block scope. This can have unexpected consequences, so define all variables at the top of the function body.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.108.11