VaR, let, const and code examples

Time:2021-6-22

1. Declaration assignment of let, VaR, const

    var b = 1;
    let a = 2;
    const c = 3;
    console.log("a", a); // 1
    console.log("b", b); // 2
    console.log("c", c); // 3

VaR, let, const and code examples

2. The scope of let, VaR, const

  1. Under the overall situation

    var a = 1;
    let b = 2;
    const c = 3;
    console.log("a", a); // 1
    console.log("b", b); // 2
    console.log("c", c); // 3
    console.log("window.a", window.a); // 1
    console.log("window.b", window.b); // undefind
    console.log("window.c", window.c); // undefind
    

    VaR, let, const and code examples

  2. Local conditions

    1. Var declaration

var a=1
function fn(){
    var a=2
    Console.log ('local a ', a in FN) // 2
}
Console.log ('a ', a of global var declaration assignment) // 1
fn()
Console.log ('global a ', a after executing FN) // 1
```

![image.png](/img/bVbLtQL)

2. Let's declare

Recommended Today

What is “hybrid cloud”?

In this paper, we define the concept of “hybrid cloud”, explain four different cloud deployment models of hybrid cloud, and deeply analyze the industrial trend of hybrid cloud through a series of data and charts. 01 introduction Hybrid cloud is a computing environment that integrates multiple platforms and data centers. Generally speaking, hybrid cloud is […]