"use strict";
//严格模式
<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> </head> <body> <script> "use strict"; (function() { var a = b = 5; })();
//这个会报错哦; console.log(b); </script> </body> </html>
<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> </head> <body> <script> (function() { var a = b = 5; })();
//这个居然跑出来一个5,尼玛!! console.log(b); </script> </body> </html>