javaScript strict Mode and Window

来源:互联网 发布:域名可以续费吗 编辑:程序博客网 时间:2024/05/11 19:58
js strict can check more error and make your cede quick run .the code as:
        <script type="text/javascript">            'use strict'            function  doing(){                employee=1;            }            doing();            alert(employee)        </script>
the console would export error that employee has not defined , you can declaraction 'use strict' to join strict mode.ofcourse you can delaraction variable by window Object as:
        <script type="text/javascript">            function  doing(){                window.demo=1;            }            doing()            alert(window.demo)        </script>
the demo will be gloabe variable  it is will be ok
1 0
原创粉丝点击