Undefined

Discussion in 'Learning Javascript' started by firststef, Jul 26, 2017.

  1. firststef

    firststef Veteran Veteran

    Messages:
    79
    Likes Received:
    8
    First Language:
    Romanian
    Where can i effectively define a variable because it seems no matter where i put

    var a = 0;
    console.log(a)

    it shows undefined.

    Currently modifying a plugin and i need a new variable.
     
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,324
    Likes Received:
    6,437
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    That is exactly the problem - it depends on where you put which command.
    And that is not the same answer everywhere, because in some positions it becomes a global definition, in others an instance definition and in still other positions it won't work at all.

    Please give a link to the website of the plugin you want to modify and tell us where you want to modify it, then we can help
     
    #2
  3. firststef

    firststef Veteran Veteran

    Messages:
    79
    Likes Received:
    8
    First Language:
    Romanian
    Sorry for the late answer i was in vacation.

    I managed it eventually. I was supposed to put the variable above ALL the code and not in a function that i would call, and also remove it from
    function(variable) to just function().
     
    #3

Share This Page