JSLint impled global

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?=

    JSLint impled global

    JSLint founds errors :
    Error:
    Implied global: findTextInTag 6, hash 3, keysAry 2

    "findTextIn Tag" is an external function to the calling one

    hash and keysAry are (supposed to be?) global variables defined like
    that :

    var keysAry = new Array();
    keysAry = [ "name", "address", "tel", "email", "url", "im", "note" ];

    var hash = new Array();
    // "name", "address", "tel", "email", "url", "im",
    "note"
    hash[ "all" ] = [ true, true, true, true, true, true,
    true ];
    [...]
    hash[ "note" ] = [ false, false, false, false, false, false,
    true ];


    the script is working however i wonder about those "errors", in other
    word how to make the variables "hash" and "keysAry" explicitely globals
    ?

    also, the function "findTextIn Tag" is called (always) from another one
    "findTextInWhat ", there are defined like that :

    function findTextInWhat( person, txt, what ) {
    // the content //
    }
    function findTextInTag( person, txt, tag ) {
    // the content //
    }

    more precisely why this is an error calling "findTextIn Tag" from inside
    "findTextInWhat " ?

    what means "implied global" here ? I'd suppose implied is opposed to
    explicit ?
    --
    Une Bévue
  • =?ISO-8859-1?Q?Une_B=E9v?==?ISO-8859-1?Q?ue?=

    #2
    Re: JSLint impled global

    Tom de Neef <tdeneef@qolor. nlwrote:
    >
    JSLint expects that all variables and functions are declared before they are
    used or invoked. This allows it to detect implied global variables. It is
    also good practice because it makes programs easier to read.
    OK, thanks a lot, in fact i didn't cut'n paste all of my code, that's
    the reason way JSLint didn't see some variables as being explicitely
    global...

    I thought i had missunderstood something...
    --
    Une Bévue

    Comment

    Working...