Let's talk about the execution of functions with the same name and variables in js.
It is tested that functions of the same name defined in the same file or in different js files are not written in the form of closures. During the call, a function defined later is executed. Even in this case, the execution of the following code will pop up 2:
<Script type = "text/javascript"> function t () {alert (1) ;}t (); function t () {alert (2) ;}</script>
In addition,Variables and css styles are also subject to the future.
However, if a function is written in this way, 1 is displayed when the preceding function is executed. I do not know why.
<Script type = "text/javascript"> var t = function () {alert (1);} function t () {alert (2);} t (); </script>
The above discussion about the execution of functions with the same name and variables in js is all the content that I have shared with you. I hope to give you a reference and support for the help house.