JS declares two variables with the same variable name

When writing, you should probably not write the same variable name, that is, the local variable and the global variable may have the same name

However, when both are variables in the same region, such as all global variables

other languages probably report errors, but JS is too tolerant. It’s a little difficult to report errors

        var t={
            u:"syyys"
        }
        var t="ss";

Now the second is equivalent to

t="ss";

Similar Posts: