Welcome Guest.

1Answers

JavaScript scope problem

Asked by: Anthony Evans 203 views IT March 4, 2019

As shown in the picture, trouble everyone to talk about it, I am Xiaobai, thank you

1 Answers

  1. +8Votes  

    A in your program is a global variable, which is available throughout JS

    and b, a local variable in c, whose scope is limited to the function that defines it

    that is, b can only be used for test() and its function demo()

    and c can only be used for demo()

    so a and b will output 123.

    and the last c will not have output

    Thomas Taylor- March 4, 2019 |