0

For example, vrb is a global variable:

<script>
    var vrb = 25

    if (true) {
        var vrb = 15
    }

    document.write(vrb)
</script>

, what did it occured in my script related to vrb variable? I know about shadowing but I think that this is not the term for what I asked.

ciapi1369
  • 45
  • 4
  • 2
    It's just overwriting the variable. `var` does not have a block scope, there is only a single `vrb` defined here. – VLAZ Apr 14 '22 at 09:47

0 Answers0