showing results for - "let javascript"
Hana
30 Apr 2016
1// `let` vs `var` vs `const` in 'javascript'
2
3"let" allows you to declare local variable whose scope 
4      is limited to the block statement.
5
6"var" allows you to declare a variable globally or locally 
7      to an entire function.
8
9"Const" just like let, are block-scoped.
10        It's value can't be reassigned and it can't be redeclared.
11
Sofia
28 Oct 2020
1The let statement declares a block scope local variable, optionally initializing it to a value.
2
3let x = 1;
4
5if (x === 1) {
6  let x = 2;
7
8  console.log(x);
9  // expected output: 2
10}
11
12console.log(x);
13// expected output: 1
Blanche
24 Sep 2018
1The let statement declares a block-scoped local variable, 
2  optionally initializing it to a value.
3let x=1;
Sara
24 Jul 2019
1* Variables defined with let cannot be redeclared.
2* You cannot accidentally redeclare a variable.
3
4let x = "John Doe";
5
6let x = 0;
7
8// SyntaxError: 'x' has already been declared