Variables declaration

Attribute(s)

  • Declarations

    Description

    Declarations: All variables have to declared in JavaScript

    Motivation

    It is important to have an overview of all used variables in a function. Especially when using JS debuggers.

    Example / Details

    All variables will be declared in the script.

    In general, declare the variable local in a function.
    Declare local variables at the top of the function.

    Global variables are allowed, but use them as less as possible.
    Declare global variables at the top of the JS Header event.




  • JS_Header_Variables.jpg