标签:ros 自己 一个 alert fine html rip doc ==
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> body { font-family: "Microsoft YaHei", serif; } body, dl, dd, p, h1, h2, h3, h4, h5, h6 { margin: 0; } ol, ul, li { margin: 0; padding: 0; list-style: none; } img { border: none } </style> </head> <body> <script> var x = 5; a(); function a() { alert(x); var x=10; } alert(x); // 每执行到一个新的作用域,按照规则去解析 // 1定义 //var x; //function f() {...} // 2执行 // x=5 // a()====>新的作用域 // 1定义 // var x // 2执行(自己有就用自己的,自己没有就用父亲的) // alert(x) undefined // x = 10-vue-router; // alert(x) 5 </script> </body> </html>
标签:ros 自己 一个 alert fine html rip doc ==
原文地址:https://www.cnblogs.com/zhangyu666/p/11479765.html