zoukankan      html  css  js  c++  java
  • ECMA262(v5)点滴(一)

     variable statment(变量语句)

    A variable statement declares variables that are created as defined in 10.5. Variables are initialised to undefined when created. A variable with an Initialiser is assigned the value of its AssignmentExpression when the VariableStatement is executed, not when the variable is created.

    这里很很重要的一句:

    A variable with an Initialiser is assigned the value of its AssignmentExpression when the VariableStatement is executed, not when the variable is created.
    可见,如 var a=5;这种形式的语句是分两步进行的:

    第一步,创建 variable a, 保证变量的存在

    第二步,执行,对变量a赋值

    如果像这样

    var a=1 ;

    var b=2;

    var c=3;

    则是:

    第一步 ,创建变量a,b,c,此时他们的值都是undefined

    第二部,对 a,b,c 分别赋值

    注意:

    只有当执行上下文(execution context)建立后才会进行上面的两步。

  • 相关阅读:
    MyCAT-安装配置读写分离
    MYSQL-GTID复制
    Harbor使用
    ansible-playbook(合集)
    Ansible批量添加主机
    MyCAT+MGR
    随笔说明
    常用sql语句
    接口测试基础
    正则表达式
  • 原文地址:https://www.cnblogs.com/argb/p/2099298.html
Copyright © 2011-2022 走看看